Class: TotalRecall::BankParser
- Inherits:
-
Object
- Object
- TotalRecall::BankParser
- Defined in:
- lib/total_recall.rb
Instance Attribute Summary collapse
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ BankParser
constructor
A new instance of BankParser.
-
#parse(str, options = {}) ⇒ Array<Hash>
Parses csv content and returns array of hashes.
Constructor Details
#initialize(options = {}) ⇒ BankParser
Returns a new instance of BankParser.
191 192 193 |
# File 'lib/total_recall.rb', line 191 def initialize(={}) @strategy = [:strategy] end |
Instance Attribute Details
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
189 190 191 |
# File 'lib/total_recall.rb', line 189 def strategy @strategy end |
Instance Method Details
#parse(str, options = {}) ⇒ Array<Hash>
Parses csv content and returns array of hashes.
203 204 205 206 207 208 209 |
# File 'lib/total_recall.rb', line 203 def parse(str, ={}) = strategy..merge() result = [] CSV.parse(str, ){|row| result << strategy.parse_row(row)} result end |