Class: PtabModel
- Inherits:
-
Object
- Object
- PtabModel
- Defined in:
- lib/ptab.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data) ⇒ PtabModel
constructor
A new instance of PtabModel.
Constructor Details
#initialize(data) ⇒ PtabModel
Returns a new instance of PtabModel.
87 88 89 90 91 92 93 94 |
# File 'lib/ptab.rb', line 87 def initialize(data) inflector = Dry::Inflector.new data.each {|key, value| underscore_key = inflector.underscore(key) instance_variable_set("@#{underscore_key}", value) self.class.send(:attr_reader, underscore_key) # Dynamically create an accessor } end |
Class Method Details
.objects ⇒ Object
96 97 98 |
# File 'lib/ptab.rb', line 96 def self.objects @objects end |