Sha256: 09a8c6cd7a1643e91d21046d743198635fb123bd37100ea8948711af672be034

Contents?: true

Size: 782 Bytes

Versions: 1

Compression:

Stored size: 782 Bytes

Contents

module Mobility
=begin

Class to access Mobility across backends. In particular, keeps a record of
which {Attributes} modules have been included on the model class.

=end
  class Accumulator
    # @return [Array<Attributes>]
    attr_reader :modules

    # @param [Class] model_class Model class
    def initialize
      @modules = []
    end

    # @return [Array<String>] Translated attributes defined on model
    def translated_attribute_names
      modules.map(&:names).flatten
    end

    # Appends backend module to +modules+ array for later reference.
    # @param [Attributes] backend_module Attributes module
    def << backend_module
      modules << backend_module
    end

    def initialize_dup(other)
      @modules = other.modules.dup
      super
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mobility-0.6.0 lib/mobility/accumulator.rb