Module: Footing::Object

Defined in:
lib/footing/extensions/object.rb

Instance Method Summary collapse

Instance Method Details

#eigenObject

Returns the eigen class for the object.



5
6
7
8
9
10
11
# File 'lib/footing/extensions/object.rb', line 5

def eigen
  class << self
    self
  end
rescue Exception
  nil
end

#has_eigen?Boolean

Indicates if the object has an eigen class.

Returns:

  • (Boolean)


14
15
16
# File 'lib/footing/extensions/object.rb', line 14

def has_eigen?
  !eigen.nil?
end

#try(name, *args, &block) ⇒ Object

Trys to invoke a method on the object. Returns nil if the method isn’t supported.



20
21
22
23
24
25
# File 'lib/footing/extensions/object.rb', line 20

def try(name, *args, &block)
  if respond_to?(name)
    return public_send(name, *args, &block)
  end
  nil
end