Module: Real
Class Method Summary collapse
-
.const_missing(const_name) ⇒ Object
private
Access to project metadata, e.g.
-
.index ⇒ Object
private
Load project metadata file.
Instance Method Summary collapse
- #bind_call(c, m, o, *a, &b) ⇒ Object private
-
#class(*a, &b) ⇒ Class
Get object’s real class.
-
#id(*a, &b) ⇒ Integer
Get object’s real id.
-
#instance_methods(*a, &b) ⇒ Array<Symbol>
Get class/module’s real instance methods.
-
#methods(*a, &b) ⇒ Array<Symbol>
Get object’s real methods.
-
#private_instance_methods(*a, &b) ⇒ Array<Symbol>
Get class/module’s real private instance methods.
-
#private_methods(*a, &b) ⇒ Array<Symbol>
Get object’s real private methods.
-
#protected_instance_methods(*a, &b) ⇒ Array<Symbol>
Get class/module’s real protected instance methods.
-
#protected_methods(*a, &b) ⇒ Array<Symbol>
Get object’s real protected methods.
-
#public_instance_methods(*a, &b) ⇒ Array<Symbol>
Get class/module’s real public instance methods.
-
#public_methods(*a, &b) ⇒ Array<Symbol>
Get object’s real public methods.
Class Method Details
.const_missing(const_name) ⇒ Object (private)
Access to project metadata, e.g. VERSION.
92 93 94 95 |
# File 'lib/real.rb', line 92 def self.const_missing(const_name) name = const_name.to_s.downcase index[name] || super(const_name) end |
.index ⇒ Object (private)
Load project metadata file.
100 101 102 103 104 105 |
# File 'lib/real.rb', line 100 def self.index @index ||= ( require 'yaml' YAML.load_file(File.join(File.dirname(__FILE__), 'real.yml')) ) end |
Instance Method Details
#bind_call(c, m, o, *a, &b) ⇒ Object (private)
84 85 86 87 |
# File 'lib/real.rb', line 84 def bind_call(c, m, o, *a, &b) im = c.instance_method(m) im.bind(o).call(*a, &b) end |
#class(*a, &b) ⇒ Class
Get object’s real class.
18 19 20 |
# File 'lib/real.rb', line 18 def class(*a, &b) bind_call(Object, :class, *a, &b) end |
#id(*a, &b) ⇒ Integer
Get object’s real id.
11 12 13 |
# File 'lib/real.rb', line 11 def id(*a, &b) bind_call(Object, :object_id, *a, &b) end |
#instance_methods(*a, &b) ⇒ Array<Symbol>
Get class/module’s real instance methods.
57 58 59 |
# File 'lib/real.rb', line 57 def instance_methods(*a, &b) bind_call(Module, :instanance_methods, *a, &b) end |
#methods(*a, &b) ⇒ Array<Symbol>
Get object’s real methods.
25 26 27 |
# File 'lib/real.rb', line 25 def methods(*a, &b) bind_call(Object, :methods, *a, &b) end |
#private_instance_methods(*a, &b) ⇒ Array<Symbol>
Get class/module’s real private instance methods.
78 79 80 |
# File 'lib/real.rb', line 78 def private_instance_methods(*a, &b) bind_call(Module, :private_instance_methods, :class, *a, &b) end |
#private_methods(*a, &b) ⇒ Array<Symbol>
Get object’s real private methods.
46 47 48 |
# File 'lib/real.rb', line 46 def private_methods(*a, &b) bind_call(Object, :private_methods, *a, &b) end |
#protected_instance_methods(*a, &b) ⇒ Array<Symbol>
Get class/module’s real protected instance methods.
71 72 73 |
# File 'lib/real.rb', line 71 def protected_instance_methods(*a, &b) bind_call(Module, :protected_instance_methods, *a, &b) end |
#protected_methods(*a, &b) ⇒ Array<Symbol>
Get object’s real protected methods.
39 40 41 |
# File 'lib/real.rb', line 39 def protected_methods(*a, &b) bind_call(Object, :protected_methods, *a, &b) end |
#public_instance_methods(*a, &b) ⇒ Array<Symbol>
Get class/module’s real public instance methods.
64 65 66 |
# File 'lib/real.rb', line 64 def public_instance_methods(*a, &b) bind_call(Module, :public_instance_methods, *a, &b) end |
#public_methods(*a, &b) ⇒ Array<Symbol>
Get object’s real public methods.
32 33 34 |
# File 'lib/real.rb', line 32 def public_methods(*a, &b) bind_call(Object, :public_methods, *a, &b) end |