Class: Typekit::Processing::Translator
- Inherits:
-
Object
- Object
- Typekit::Processing::Translator
- Defined in:
- lib/typekit/processing/translator.rb
Instance Method Summary collapse
-
#initialize(format:) ⇒ Translator
constructor
A new instance of Translator.
- #process(response) ⇒ Object
Constructor Details
#initialize(format:) ⇒ Translator
Returns a new instance of Translator.
4 5 6 |
# File 'lib/typekit/processing/translator.rb', line 4 def initialize(format:) @parser = Parser.build(format) end |
Instance Method Details
#process(response) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/typekit/processing/translator.rb', line 8 def process(response) data = @parser.process(response.body) rescue nil data = { nil => nil } unless data.is_a?(Hash) && data.length == 1 name, object = *data.first Converter.build(name).process(response, object) end |