Class: DataView::DataView::Row
- Inherits:
-
Object
- Object
- DataView::DataView::Row
- Includes:
- Enumerable
- Defined in:
- lib/data_view.rb
Instance Attribute Summary collapse
-
#data_view ⇒ Object
Returns the value of attribute data_view.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #each ⇒ Object
-
#initialize(data_view, values = {}) ⇒ Row
constructor
A new instance of Row.
- #length ⇒ Object
Constructor Details
#initialize(data_view, values = {}) ⇒ Row
Returns a new instance of Row.
9 10 11 12 |
# File 'lib/data_view.rb', line 9 def initialize(data_view, values = {}) @data_view = data_view @values = values end |
Instance Attribute Details
#data_view ⇒ Object
Returns the value of attribute data_view.
8 9 10 |
# File 'lib/data_view.rb', line 8 def data_view @data_view end |
Instance Method Details
#[](key) ⇒ Object
13 14 15 |
# File 'lib/data_view.rb', line 13 def [](key) return @values[get_key(key)] end |
#[]=(key, value) ⇒ Object
16 17 18 |
# File 'lib/data_view.rb', line 16 def []=(key, value) @values[get_key(key)] = value end |
#each ⇒ Object
19 20 21 22 23 |
# File 'lib/data_view.rb', line 19 def each data_view.columns.each_with_index do |c, i| yield(c, @values[c]) end end |
#length ⇒ Object
24 25 26 |
# File 'lib/data_view.rb', line 24 def length @values.length end |