Sha256: ccd68aafd24fe7ed75ca99491613fd576234e378a33fc49d8d71ff75ac0ccf5f

Contents?: true

Size: 491 Bytes

Versions: 5

Compression:

Stored size: 491 Bytes

Contents

require 'active_support/concern'

module Journey::Resource::AttributeLoading
  extend ActiveSupport::Concern

  included do
    # uses defined setters in place of attributes[key] where possible,
    # for the purpose of enums
    def load(attributes, remove_root = false, persisted = false)
      super(attributes, remove_root, persisted).tap do
        self.attributes.each do |key, value|
          send("#{key}=", value) if respond_to?("#{key}=")
        end
      end
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
embark-journey-0.0.11 lib/journey/resource/attribute_loading.rb
embark-journey-0.0.10 lib/journey/resource/attribute_loading.rb
embark-journey-0.0.9 lib/journey/resource/attribute_loading.rb
embark-journey-0.0.8 lib/journey/resource/attribute_loading.rb
embark-journey-0.0.7 lib/journey/resource/attribute_loading.rb