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

Access attribute value

Parameters:

  • name (Symbol)

    The name of the attribute

Returns:

  • (Object)


28
29
30
# File 'lib/rom/struct.rb', line 28

def [](name)
  instance_variable_get("@#{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.

Coerce to hash

Returns:

  • (Hash)


17
18
19
# File 'lib/rom/struct.rb', line 17

def to_hash
  to_h
end