Class: ObjectReflection
Direct Known Subclasses
Constant Summary collapse
- REFLECTION_METHODS =
[ :object_id, :class, :methods, :send ] + Kernel.instance_methods.select{ |m| m =~ /^object_/ }
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(object) ⇒ ObjectReflection
constructor
A new instance of ObjectReflection.
Constructor Details
#initialize(object) ⇒ ObjectReflection
Returns a new instance of ObjectReflection.
41 42 43 44 45 46 47 |
# File 'lib/more/facets/reflection.rb', line 41 def initialize(object) @self = object = REFLECTION_METHODS.inject({}) do |rproc, meth| rproc[meth.to_sym] = Kernel.instance_method(meth).bind(@self) rproc end end |
Instance Method Details
#id ⇒ Object
51 52 53 |
# File 'lib/more/facets/reflection.rb', line 51 def id [:object_id].call end |