Class: ModelExplorer::Record
- Inherits:
-
Object
- Object
- ModelExplorer::Record
- Defined in:
- lib/model_explorer/record.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#primary_key ⇒ Object
readonly
Returns the value of attribute primary_key.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(primary_key, attributes, klass) ⇒ Record
constructor
A new instance of Record.
Constructor Details
#initialize(primary_key, attributes, klass) ⇒ Record
Returns a new instance of Record.
5 6 7 8 9 |
# File 'lib/model_explorer/record.rb', line 5 def initialize(primary_key, attributes, klass) @primary_key = primary_key @attributes = attributes.with_indifferent_access @klass = klass end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/model_explorer/record.rb', line 3 def attributes @attributes end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
3 4 5 |
# File 'lib/model_explorer/record.rb', line 3 def klass @klass end |
#primary_key ⇒ Object (readonly)
Returns the value of attribute primary_key.
3 4 5 |
# File 'lib/model_explorer/record.rb', line 3 def primary_key @primary_key end |
Instance Method Details
#[](key) ⇒ Object
11 12 13 |
# File 'lib/model_explorer/record.rb', line 11 def [](key) attributes[key.to_s] end |