Class: Festoon::Dynamic
- Inherits:
-
Object
show all
- Defined in:
- lib/festoon/dynamic.rb
Instance Method Summary
collapse
Constructor Details
#initialize(thing) ⇒ Dynamic
Returns a new instance of Dynamic.
3
4
5
|
# File 'lib/festoon/dynamic.rb', line 3
def initialize(thing)
@thing = thing
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *args, &block) ⇒ Object
7
8
9
|
# File 'lib/festoon/dynamic.rb', line 7
def method_missing(method_id, *args, &block)
intercept_return_self(thing.public_send(method_id, *args, &block))
end
|
Instance Method Details
#==(other) ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/festoon/dynamic.rb', line 19
def ==(other)
if other.is_a?(self.class)
other == thing
else
thing == other
end
end
|
#__decompose__ ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/festoon/dynamic.rb', line 11
def __decompose__
if thing.respond_to?(:__decompose__)
[self, *thing.__decompose__]
else
[self, thing]
end
end
|