lib/attribute_predicates/extensions/module.rb in attribute_predicates-0.2.0 vs lib/attribute_predicates/extensions/module.rb in attribute_predicates-0.2.1

- old
+ new

@@ -53,24 +53,24 @@ send("#{method}_without_predicates", *symbols) symbols.each {|symbol| attr_predicate(symbol)} end end - private - # Returns true if the specified variable is not blank, otherwise false - def attr_predicate(symbol) - define_method("#{symbol}?") do - value = instance_variable_get("@#{symbol}") - if value.respond_to?(:blank?) - # Use ActiveSupport's implementation - !value.blank? - elsif value.respond_to?(:empty?) - !value.empty? - else - !!value - end + # Returns true if the specified variable is not blank, otherwise false + def attr_predicate(symbol) + define_method("#{symbol}?") do + value = instance_variable_get("@#{symbol}") + if value.respond_to?(:blank?) + # Use ActiveSupport's implementation + !value.blank? + elsif value.respond_to?(:empty?) + !value.empty? + else + !!value end end + end + private :attr_predicate end end end ::Module.class_eval do