lib/active_object/object.rb in active_object-1.0.1 vs lib/active_object/object.rb in active_object-1.0.2
- old
+ new
@@ -1,8 +1,8 @@
class Object
- unless method_defined?(:blank?)
+ unless defined?(Rails)
def blank?
object = self
object = object.strip if respond_to?(:strip)
respond_to?(:empty?) ? !!object.empty? : !object
end
@@ -14,22 +14,22 @@
def palindrome?
to_s == to_s.reverse
end
- unless method_defined?(:present?)
+ unless defined?(Rails)
def present?
!blank?
end
end
- unless method_defined?(:try)
+ unless defined?(Rails)
def try(*a, &b)
try!(*a, &b) if a.empty? || respond_to?(a.first)
end
end
- unless method_defined?(:try!)
+ unless defined?(Rails)
def try!(*a, &b)
if a.empty? && block_given?
b.arity.zero? ? instance_eval(&b) : yield(self)
else
public_send(*a, &b)
\ No newline at end of file