Class: SimpleEtl::Source::Row
- Inherits:
-
Object
- Object
- SimpleEtl::Source::Row
- Defined in:
- lib/simple_etl/source/row.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Row
constructor
A new instance of Row.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Row
Returns a new instance of Row.
6 7 8 |
# File 'lib/simple_etl/source/row.rb', line 6 def initialize attributes = {} @attributes = attributes end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/simple_etl/source/row.rb', line 10 def method_missing name, *args, &block md = name.to_s.match /^(\w+)(=)?$/ if md && attributes.has_key?(md[1].to_sym) field = md[1].to_sym md[2] && (attributes[field] = args.first) || attributes[field] else super end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/simple_etl/source/row.rb', line 4 def attributes @attributes end |