Class: QuickTicker::Table
- Inherits:
-
Object
- Object
- QuickTicker::Table
- Defined in:
- lib/table.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data_hash) ⇒ Table
constructor
A new instance of Table.
- #populate_table_columns(data_hash) ⇒ Object
Constructor Details
#initialize(data_hash) ⇒ Table
Returns a new instance of Table.
5 6 7 8 9 10 |
# File 'lib/table.rb', line 5 def initialize(data_hash) self.class.create_table_columns(data_hash) self.populate_table_columns(data_hash) end |
Class Method Details
.create_table_columns(data_hash) ⇒ Object
18 19 20 21 22 |
# File 'lib/table.rb', line 18 def self.create_table_columns(data_hash) data_hash.each do |key, value| attr_accessor key.to_sym end end |
Instance Method Details
#populate_table_columns(data_hash) ⇒ Object
12 13 14 15 16 |
# File 'lib/table.rb', line 12 def populate_table_columns(data_hash) data_hash.each do |key, value| self.send("#{key}=", value) end end |