class Representable::Decorator
Attributes
decorated[R]
represented[R]
Public Class Methods
clone()
click to toggle source
This is called from inheritable_attr when inheriting a decorator class to a subclass. Explicitly subclassing the Decorator makes sure representable_attrs is a clean version.
# File lib/representable/decorator.rb, line 23 def self.clone Class.new(self) # DISCUSS: why isn't this called by Ruby? end
default_inline_class()
click to toggle source
# File lib/representable/decorator.rb, line 17 def self.default_inline_class Representable::Decorator end
new(represented)
click to toggle source
# File lib/representable/decorator.rb, line 58 def initialize(represented) @represented = represented end
prepare(represented)
click to toggle source
TODO: when moving all class methods into ClassMethods, i get a segfault.
# File lib/representable/decorator.rb, line 13 def self.prepare(represented) new(represented) end
Private Class Methods
build_inline(base, features, name, options, &block)
click to toggle source
# File lib/representable/decorator.rb, line 63 def self.build_inline(base, features, name, options, &block) Class.new(base || default_inline_class) do feature *features class_eval &block end end