class Icing::Decorations::Base

Public Instance Methods

decorated(object, method_name, *args, &block) click to toggle source
# File lib/icing/decorations/base.rb, line 4
def decorated(object, method_name, *args, &block)
  object.public_send(method_name, *args, &block)
end
method_missing(name, *args, &block) click to toggle source
Calls superclass method
# File lib/icing/decorations/base.rb, line 24
def method_missing(name, *args, &block)
  if name.to_s.start_with?('wrapping_')
    wrapping_other(*args)
  else
    super
  end
end
respond_to_missing?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/icing/decorations/base.rb, line 32
def respond_to_missing?(method_name, include_private = false)
  method_name.to_s.start_with?('wrapping_') || super
end
to_a() click to toggle source
# File lib/icing/decorations/base.rb, line 20
def to_a
  [self]
end
within(other) click to toggle source
# File lib/icing/decorations/base.rb, line 12
def within(other)
  other.wrapping_other(self)
end
wrapping(other) click to toggle source
# File lib/icing/decorations/base.rb, line 8
def wrapping(other)
  other.within(self)
end
wrapping_other(other) click to toggle source
# File lib/icing/decorations/base.rb, line 16
def wrapping_other(other)
  decoration_factory.composite([other.to_a, self].flatten(1))
end

Private Instance Methods

decoration_factory() click to toggle source
# File lib/icing/decorations/base.rb, line 38
def decoration_factory
  Icing.decoration_factory
end