Sha256: 8177f929f546b00bd304c461a73cbb29a4501648bba73b882b5164a15948bae9
Contents?: true
Size: 664 Bytes
Versions: 2
Compression:
Stored size: 664 Bytes
Contents
module Representable class Decorator attr_reader :represented alias_method :decorated, :represented def self.prepare(represented) new(represented) # was: PrepareStrategy::Decorate. end include Representable # include after class methods so Decorator::prepare can't be overwritten by Representable::prepare. def initialize(represented) @represented = represented end def representable_binding_for(attr, format, options) context = attr.options[:decorator_scope] ? self : represented # DISCUSS: should Decorator know this kinda stuff? format.build(attr, represented, options, context) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
representable-1.5.3 | lib/representable/decorator.rb |
representable-1.5.2 | lib/representable/decorator.rb |