- alias_singleton_method
- define_private_singleton_method
- define_protected_singleton_method
- define_singleton_method
- eigen_eval
- eigenclass
- metaclass
- private_singleton_method
- protected_singleton_method
- public_singleton_method
Evaluates a string containing Ruby source code, or the given block within the context of the invoking object‘s eigenclass.
obj.eigen_eval { block } would be equivalent to obj.eigenclass.instance_eval { block }
[ show source ]
# File lib/metable/instance_methods.rb, line 24
24: def eigen_eval(*args, &block)
25: eigenclass.instance_eval(*args, &block)
26: end
Returns the invoking object‘s eigenclass.
[ show source ]
# File lib/metable/instance_methods.rb, line 5 5: def eigenclass 6: class << self 7: self 8: end 9: end
Alias for eigenclass
Makes the invoking object‘s existing singleton methods private.
[ show source ]
# File lib/metable/instance_methods.rb, line 30
30: def private_singleton_method(*method_ids)
31: eigen_eval { private *method_ids }
32: end
Makes the invoking object‘s existing singleton methods protected.
[ show source ]
# File lib/metable/instance_methods.rb, line 35
35: def protected_singleton_method(*method_ids)
36: eigen_eval { protected *method_ids }
37: end
Makes the invoking object‘s existing singleton methods public.
[ show source ]
# File lib/metable/instance_methods.rb, line 40
40: def public_singleton_method(*method_ids)
41: eigen_eval { public *method_ids }
42: end
Makes new_id an alias of the singleton method old_id within the invoking object.
[ show source ]
# File lib/metable/instance_methods.rb, line 49
49: def alias_singleton_method(new_id, old_id) # :doc:
50: eigen_eval { alias_method new_id, old_id }
51: end
define_private_singleton_method(symbol) { block } → proc
Defines a private singleton method on the invoking object (similar to define_method).
[ show source ]
# File lib/metable/instance_methods.rb, line 75
75: def define_private_singleton_method(*args, &block) # :doc:
76: define_singleton_method(*args, &block)
77: private_singleton_method(args.first)
78: end
define_protected_singleton_method(symbol) { block } → proc
Defines a protected singleton method on the invoking object (similar to define_method).
[ show source ]
# File lib/metable/instance_methods.rb, line 87
87: def define_protected_singleton_method(*args, &block) # :doc:
88: define_singleton_method(*args, &block)
89: protected_singleton_method(args.first)
90: end
Defines a public singleton method on the invoking object (similar to define_method).
Aliased as define_public_singleton_method
[ show source ]
# File lib/metable/instance_methods.rb, line 62
62: def define_singleton_method(*args, &block) # :doc:
63: eigen_eval { define_method(*args, &block) }
64: end