Sha256: a393a79409570029997d63a1764169af1e105c1e59de3ef2f5b51a5b8b265f44
Contents?: true
Size: 1.12 KB
Versions: 17
Compression:
Stored size: 1.12 KB
Contents
module Locomotive::Steam module Models module Entity include Locomotive::Steam::Models::Concerns::Validation include Locomotive::Steam::Models::Concerns::ToJson attr_accessor :attributes, :associations, :localized_attributes, :base_url def initialize(attributes) @attributes = attributes.with_indifferent_access end def method_missing(name, *args, &block) _name = name.to_s if attributes.include?(_name) self[_name] elsif _name.end_with?('=') && attributes.include?(_name.chop) self[_name.chop] = args.first else super end end def respond_to?(name, include_private = false) attributes.include?(name.to_s) || super end def _id self['_id'] end def []=(name, value) attributes[name] = value end def [](name) attributes[name] end def change(new_attributes) attributes.merge!((new_attributes || {}).with_indifferent_access) self end def serialize attributes.dup end end end end
Version data entries
17 entries across 17 versions & 1 rubygems