Class: Symbol
Overview
Override Symbols operations (+,*,-)
Class Method Summary
collapse
Instance Method Summary
collapse
#_, #__, #label
#*, #+, #-, #/, #check_arg, #coerce
Class Method Details
.install_modifier_hook ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/rmasm/core_override.rb', line 25
def self.install_modifier_hook()
define_method(:rmasm_array_square_hook, instance_method(:[])) if Symbol.method_defined?(:[])
define_method(:[], instance_method(:array_modifier))
define_method(:<<, instance_method(:inject_modifier))
end
|
.remove_modifier_hook ⇒ Object
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/rmasm/core_override.rb', line 49
def self.remove_modifier_hook()
if Symbol.method_defined?(:rmasm_array_square_hook)
define_method(:[], instance_method(:rmasm_array_square_hook))
else
undef_method(:[])
end
undef_method(:<<)
end
|
Instance Method Details
#array_modifier(*args) ⇒ Object
33
34
35
36
|
# File 'lib/rmasm/core_override.rb', line 33
def array_modifier(*args)
RMasm::SymbolModifier.new(self, args)
end
|
#inject_modifier(arg) ⇒ Object
38
39
40
41
42
43
|
# File 'lib/rmasm/core_override.rb', line 38
def inject_modifier(arg)
value = RMasm::SymbolModifier.new(self, 0)
value << arg
value
end
|
#struct(*args, &block) ⇒ Object