Sha256: 5f51cd2d21f016422e76ae508d9075c9fc5afb25f9594a88b428a6bdcfc55f1a

Contents?: true

Size: 492 Bytes

Versions: 1

Compression:

Stored size: 492 Bytes

Contents

module Representable
  class Decorator
    attr_reader :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)
      format.build(attr, represented, options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
representable-1.4.0 lib/representable/decorator.rb