Class: Reflect
- Inherits:
-
Object
- Object
- Reflect
- Defined in:
- lib/lib/reflect.rb
Class Method Summary collapse
Class Method Details
.field(o, field) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/lib/reflect.rb', line 6 def Reflect.field(o,field) begin result = o[field] result = o[field.to_sym] if result == nil return result rescue => e return field end end |
.fields(o) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/lib/reflect.rb', line 16 def Reflect.fields(o) if o.respond_to?("attributes") return o.attributes else return o.keys end end |
.is_function(f) ⇒ Object
24 25 26 |
# File 'lib/lib/reflect.rb', line 24 def Reflect.is_function(f) return f.respond_to?("call") end |