Class: ResoTransport::DatasystemParser
- Inherits:
-
Object
- Object
- ResoTransport::DatasystemParser
- Defined in:
- lib/reso_transport/datasystem_parser.rb
Instance Method Summary collapse
- #parse(doc) ⇒ Object
-
#resources ⇒ Object
value -> Resources -> Name -> ResourcePath -> Localizations -> Name -> ResourcePath ->.
Instance Method Details
#parse(doc) ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/reso_transport/datasystem_parser.rb', line 3 def parse(doc) begin data = doc.is_a?(File) ? doc.read : doc @json = JSON.parse data rescue JSON::ParserError => e @json = {} puts e. end self end |
#resources ⇒ Object
value ->
Resources ->
Name ->
ResourcePath ->
Localizations ->
Name ->
ResourcePath ->
22 23 24 |
# File 'lib/reso_transport/datasystem_parser.rb', line 22 def resources @resources ||= @json['value'].map { |v| v['Resources'] }.flatten.compact.map { |r| [r['Name'], r] }.to_h end |