Class: ModelExplorer::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/model_explorer/record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#attributesObject (readonly)

Returns the value of attribute attributes.



3
4
5
# File 'lib/model_explorer/record.rb', line 3

def attributes
  @attributes
end

#klassObject (readonly)

Returns the value of attribute klass.



3
4
5
# File 'lib/model_explorer/record.rb', line 3

def klass
  @klass
end

#primary_keyObject (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