Class: Zelda::Base
- Inherits:
-
Object
- Object
- Zelda::Base
- Defined in:
- lib/zelda/base.rb
Overview
Abstract base class to provide common functionality of Zelda importer classes. Every key in the hash is turned into a method, returning the value.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(attributes = {}) ⇒ Base
Returns a new instance of Base.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/zelda/base.rb', line 5 def initialize(attributes={}) @attributes = attributes @attributes.each_pair do |key, value| self.class.send(:define_method, key) do if @attributes[key].is_a?(String) @attributes[key].force_encoding("UTF-8") else @attributes[key] end end end end |