Sha256: 69f39bf1b528fed78b2e423ad20e2d3b1c8c3dec5d131b6cb9131436bc2e58c9

Contents?: true

Size: 718 Bytes

Versions: 3

Compression:

Stored size: 718 Bytes

Contents

module Disposable
  class Twin
    class Decorator < Representable::Decorator
      include Representable::Hash
      include AllowSymbols

      # DISCUSS: same in reform, is that a bug in represntable?
      def self.clone # called in inheritable_attr :representer_class.
        Class.new(self) # By subclassing, representable_attrs.clone is called.
      end

      def self.build_config
        Config.new(Definition)
      end

      def twin_names
        representable_attrs.
          find_all { |attr| attr[:twin] }.
          collect { |attr| attr.name.to_sym }
      end
    end

    class Definition < Representable::Definition
      def dynamic_options
        super + [:twin]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
disposable-0.0.9 lib/disposable/twin/representer.rb
disposable-0.0.8 lib/disposable/twin/representer.rb
disposable-0.0.7 lib/disposable/twin/representer.rb