Class: Portable::Data::Source
- Inherits:
-
Object
- Object
- Portable::Data::Source
- Defined in:
- lib/portable/data/source.rb
Overview
A single source of data. This is meant to serve as an interface / example implementation with the intention of being re-implemented within applications. For example, you may decide more database data sources would be better, so it could be connected to ORMs or other data adapters; all it really needs to provide is enumerables for each attribute.
Instance Attribute Summary collapse
-
#data_rows ⇒ Object
readonly
Returns the value of attribute data_rows.
-
#footer_rows ⇒ Object
readonly
Returns the value of attribute footer_rows.
-
#header_rows ⇒ Object
readonly
Returns the value of attribute header_rows.
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name: '', header_rows: [], footer_rows: [], data_rows: [], keys: []) ⇒ Source
constructor
Individial header and footer rows are arrays, while individual data_rows is an object like a hash, Struct, OpenStruct, or really any PORO.
Constructor Details
#initialize(name: '', header_rows: [], footer_rows: [], data_rows: [], keys: []) ⇒ Source
Individial header and footer rows are arrays, while individual data_rows is an object like a hash, Struct, OpenStruct, or really any PORO.
27 28 29 30 31 32 33 34 35 |
# File 'lib/portable/data/source.rb', line 27 def initialize(name: '', header_rows: [], footer_rows: [], data_rows: [], keys: []) @name = name.to_s @header_rows = header_rows || [] @footer_rows = || [] @data_rows = data_rows || [] @keys = keys || [] freeze end |
Instance Attribute Details
#data_rows ⇒ Object (readonly)
Returns the value of attribute data_rows.
19 20 21 |
# File 'lib/portable/data/source.rb', line 19 def data_rows @data_rows end |
#footer_rows ⇒ Object (readonly)
Returns the value of attribute footer_rows.
19 20 21 |
# File 'lib/portable/data/source.rb', line 19 def @footer_rows end |
#header_rows ⇒ Object (readonly)
Returns the value of attribute header_rows.
19 20 21 |
# File 'lib/portable/data/source.rb', line 19 def header_rows @header_rows end |
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
19 20 21 |
# File 'lib/portable/data/source.rb', line 19 def keys @keys end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
19 20 21 |
# File 'lib/portable/data/source.rb', line 19 def name @name end |