Class: SeparatedValues::Document
- Inherits:
-
Object
- Object
- SeparatedValues::Document
- Defined in:
- lib/separated_values/document.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Instance Method Summary collapse
- #[](index) ⇒ Object
-
#initialize(rows, options = DEFAULT_OPTIONS) ⇒ Document
constructor
A new instance of Document.
- #to_hash_array ⇒ Object
Constructor Details
#initialize(rows, options = DEFAULT_OPTIONS) ⇒ Document
Returns a new instance of Document.
5 6 7 8 |
# File 'lib/separated_values/document.rb', line 5 def initialize(rows, = DEFAULT_OPTIONS) @rows = rows @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/separated_values/document.rb', line 3 def @options end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
3 4 5 |
# File 'lib/separated_values/document.rb', line 3 def rows @rows end |
Instance Method Details
#[](index) ⇒ Object
10 11 12 |
# File 'lib/separated_values/document.rb', line 10 def [](index) rows[index] end |
#to_hash_array ⇒ Object
14 15 16 17 18 |
# File 'lib/separated_values/document.rb', line 14 def to_hash_array rows.map do |row| row.to_h([:schema]) end end |