lib/active_object/object.rb in active_object-4.0.2 vs lib/active_object/object.rb in active_object-4.0.3
- old
+ new
@@ -1,8 +1,8 @@
module ActiveObject::Object
- FALSE_VALUES = [false, 0, '0', 'false', 'FALSE', 'f', 'F'].freeze
- TRUE_VALUES = [true, 1, '1', 'true', 'TRUE', 't', 'T'].freeze
+ FALSE_VALUES ||= [false, 0, '0', 'false', 'FALSE', 'f', 'F'].freeze
+ TRUE_VALUES ||= [true, 1, '1', 'true', 'TRUE', 't', 'T'].freeze
def array?
is_a?(Array)
end
@@ -75,17 +75,17 @@
def truthy?
TRUE_VALUES.include?(self)
end
def try(*obj, &block)
- try!(*obj, yield(block)) if obj.empty? || respond_to?(obj.first)
+ try!(*obj, &block) if obj.empty? || respond_to?(obj.first)
end
def try!(*obj, &block)
if obj.empty? && block_given?
- block.arity.zero? ? instance_eval(yield(block)) : yield(self)
+ block.arity.zero? ? instance_eval(&block) : yield(self)
else
- public_send(*obj, yield(block))
+ public_send(*obj, &block)
end
end
end