Sha256: 048f4c6c7064ea2fe9feb4b0eeadf688cad4e7c7c574f709a94dad46dacfa16a

Contents?: true

Size: 757 Bytes

Versions: 4

Compression:

Stored size: 757 Bytes

Contents

module Locomotive::Steam
  module Models

    module Entity

      include Locomotive::Steam::Models::Concerns::Validation

      attr_accessor :attributes, :localized_attributes, :base_url

      def initialize(attributes)
        @attributes = attributes.with_indifferent_access
      end

      def method_missing(name, *args, &block)
        if attributes.include?(name)
          self[name]
        else
          super
        end
      end

      def respond_to?(name, include_private = false)
        attributes.include?(name) || super
      end

      def _id
        self[:_id]
      end

      def []=(name, value)
        attributes[name.to_sym] = value
      end

      def [](name)
        attributes[name.to_sym]
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
locomotivecms_steam-1.0.0.pre.alpha.3 lib/locomotive/steam/models/entity.rb
locomotivecms_steam-1.0.0.pre.alpha.2 lib/locomotive/steam/models/entity.rb
locomotivecms_steam-1.0.0.pre.alpha.1 lib/locomotive/steam/models/entity.rb
locomotivecms_steam-1.0.0.pre.alpha lib/locomotive/steam/models/entity.rb