Class: ROM::Struct

Inherits:
Object
  • Object
show all
Defined in:
lib/rom/struct.rb

Overview

Simple data-struct

By default mappers use this as the model

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ Object

Reads an attribute value

Parameters:

  • name (Symbol)

    The name of the attribute

Returns:

  • (Object)


24
25
26
# File 'lib/rom/struct.rb', line 24

def [](name)
  __send__(name)
end

#to_hashHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Coerces a struct to a hash

Returns:

  • (Hash)


13
14
15
# File 'lib/rom/struct.rb', line 13

def to_hash
  to_h
end

#to_sString

Returns a short string representation

Returns:

  • (String)


33
34
35
# File 'lib/rom/struct.rb', line 33

def to_s
  "#<#{self.class}:0x#{(object_id << 1).to_s(16)}>"
end