Class: Yasd::Converter
- Inherits:
-
Object
- Object
- Yasd::Converter
- Defined in:
- lib/yasd/converter.rb
Instance Method Summary collapse
- #call(data) ⇒ Object
-
#initialize(filename) ⇒ Converter
constructor
A new instance of Converter.
Constructor Details
#initialize(filename) ⇒ Converter
Returns a new instance of Converter.
5 6 7 8 9 10 11 |
# File 'lib/yasd/converter.rb', line 5 def initialize(filename) @converters = {} if filename contents = File.read(filename) instance_eval(contents) end end |
Instance Method Details
#call(data) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/yasd/converter.rb', line 13 def call(data) data.headers.each_with_object({}) do |field, new_object| new_object[field] = convert_field(field, data[field]) new_object end end |