Class: AsciiDataTools::Filter::FormattingFilter
- Defined in:
- lib/ascii-data-tools/filter.rb
Direct Known Subclasses
Instance Method Summary collapse
- #filter(record) ⇒ Object
-
#initialize(filename, type_determiner) ⇒ FormattingFilter
constructor
A new instance of FormattingFilter.
Methods inherited from Filter
#<<, #has_records?, #read, #write
Constructor Details
#initialize(filename, type_determiner) ⇒ FormattingFilter
Returns a new instance of FormattingFilter.
70 71 72 73 74 |
# File 'lib/ascii-data-tools/filter.rb', line 70 def initialize(filename, type_determiner) @formatter = Formatting::Formatter.new @filename = filename @type_determiner = type_determiner end |
Instance Method Details
#filter(record) ⇒ Object
76 77 78 79 80 81 |
# File 'lib/ascii-data-tools/filter.rb', line 76 def filter(record) encoded_record = {:ascii_string => record, :filename => @filename} type = @type_determiner.determine_type_for(encoded_record) decoded_record = type.decode(encoded_record) @formatter.format(decoded_record) end |