Skip to content

Commit 81ee405

Browse files
authored
Merge pull request rails#49776 from skipkayhil/hm-symbol-blank
Add Symbol#blank? to skip respond_to?(:empty?)
2 parents 82ae26b + 2dd3164 commit 81ee405

File tree

1 file changed

+8
-0
lines changed
  • activesupport/lib/active_support/core_ext/object

1 file changed

+8
-0
lines changed

activesupport/lib/active_support/core_ext/object/blank.rb

+8
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,14 @@ class Hash
100100
alias_method :blank?, :empty?
101101
end
102102

103+
class Symbol
104+
# A Symbol is blank if it's empty:
105+
#
106+
# :''.blank? # => true
107+
# :symbol.blank? # => false
108+
alias_method :blank?, :empty?
109+
end
110+
103111
class String
104112
BLANK_RE = /\A[[:space:]]*\z/
105113
ENCODED_BLANKS = Concurrent::Map.new do |h, enc|

0 commit comments

Comments
 (0)