Class: Hdo::StortingImporter::Converter
- Inherits:
-
Object
- Object
- Hdo::StortingImporter::Converter
- Defined in:
- lib/hdo/storting_importer/converter.rb
Instance Method Summary collapse
-
#initialize(data_source) ⇒ Converter
constructor
A new instance of Converter.
- #json_for(name, opts = nil) ⇒ Object
Constructor Details
#initialize(data_source) ⇒ Converter
Returns a new instance of Converter.
5 6 7 8 |
# File 'lib/hdo/storting_importer/converter.rb', line 5 def initialize(data_source) @data_source = data_source @cache = {} end |
Instance Method Details
#json_for(name, opts = nil) ⇒ Object
10 11 12 13 14 |
# File 'lib/hdo/storting_importer/converter.rb', line 10 def json_for(name, opts = nil) obj = data_for(name) Yajl::Encoder.encode(obj, opts && opts[:pretty]) end |