lib/has_constant.rb in has_constant-0.8.1 vs lib/has_constant.rb in has_constant-0.8.2
- old
+ new
@@ -63,18 +63,26 @@
instance_variable_set("@#{singular}", val)
end
end
define_method("#{singular}_is?") do |value|
- send(singular) == value.to_s
+ truth = send(singular) == value.to_s
+ if !truth && I18n.locale.to_s != 'en'
+ truth = I18n.with_locale(:en) { send(singular) == value.to_s }
+ end
+ truth
end
define_method("#{singular}_is_not?") do |value|
!send("#{singular}_is?", value)
end
define_method("#{singular}_in?") do |value_list|
- value_list.include? send(singular)
+ truth = value_list.include? send(singular)
+ if !truth && I18n.locale.to_s != 'en'
+ truth = I18n.with_locale(:en) { value_list.include?(send(singular)) }
+ end
+ truth
end
define_method("#{singular}_not_in?") do |value_list|
!send("#{singular}_in?", value_list)
end