Sha256: 120422637e3695deaf26cba0f9ef6b2e5ce14c18f999ddd81c16a1e85f4b349c

Contents?: true

Size: 497 Bytes

Versions: 6

Compression:

Stored size: 497 Bytes

Contents

require 'anima'

require 'rom/support/class_builder'

module ROM
  # Simple data-struct
  #
  # By default mappers use this as the model
  #
  # @api public
  class Struct
    # Coerce to hash
    #
    # @return [Hash]
    #
    # @api private
    def to_hash
      to_h
    end

    # Access attribute value
    #
    # @param [Symbol] name The name of the attribute
    #
    # @return [Object]
    #
    # @api public
    def [](name)
      instance_variable_get("@#{name}")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rom-repository-0.2.0 lib/rom/struct.rb
rom-repository-0.2.0.rc1 lib/rom/struct.rb
rom-repository-0.2.0.beta1 lib/rom/struct.rb
rom-repository-0.1.0 lib/rom/struct.rb
rom-repository-0.0.2 lib/rom/struct.rb
rom-repository-0.0.1 lib/rom/struct.rb