lib/duck_puncher/ducks/string.rb in duck_puncher-2.6.0 vs lib/duck_puncher/ducks/string.rb in duck_puncher-2.7.0
- old
+ new
@@ -10,12 +10,12 @@
end unless method_defined?(:underscore)
def to_boolean(strict = false)
@boolean_map ||= begin
truths, falsities = %w(true 1 yes y on), ['false', '0', 'no', 'n', 'off', '']
- Hash[truths.product([true]) + falsities.product([false])]
+ ::Hash[truths.product([true]) + falsities.product([false])]
end
- strict ? !downcase.in?(falsities) : @boolean_map[downcase]
+ strict ? !downcase.in?(falsities) : !!@boolean_map[downcase]
end
end
end
end