class Festoon::Dynamic

Public Class Methods

new(thing) click to toggle source
# File lib/festoon/dynamic.rb, line 3
def initialize(thing)
  @thing = thing
end

Public Instance Methods

==(other) click to toggle source
# File lib/festoon/dynamic.rb, line 19
def ==(other)
  if other.is_a?(self.class)
    other == thing
  else
    thing == other
  end
end
__decompose__() click to toggle source
# File lib/festoon/dynamic.rb, line 11
def __decompose__
  if thing.respond_to?(:__decompose__)
    [self, *thing.__decompose__]
  else
    [self, thing]
  end
end
method_missing(method_id, *args, &block) click to toggle source
# 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

Private Instance Methods

intercept_return_self(value) click to toggle source
# File lib/festoon/dynamic.rb, line 33
def intercept_return_self(value)
  value == thing ? self : value
end
respond_to_missing?(method_id, *args) click to toggle source
# File lib/festoon/dynamic.rb, line 37
def respond_to_missing?(method_id, *args)
  thing.respond_to?(method_id)
end
thing() click to toggle source
# File lib/festoon/dynamic.rb, line 29
def thing
  @thing
end