Module: Transcriber::Resource::Parser
- Included in:
- Transcriber::Resource, Embeddable, Property
- Defined in:
- lib/transcriber/resource/parser.rb
Instance Method Summary collapse
Instance Method Details
#parse(input, options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/transcriber/resource/parser.rb', line 8 def parse(input, = {}) entries = prepare_entries(input, ) if entries.any? {|e| !e.kind_of?(Hash)} fail "invalid input" if [:fail] return [] end entries.collect do |item| parse_item(item.with_indifferent_access, ) end end |
#parse!(input, options = {}) ⇒ Object
4 5 6 |
# File 'lib/transcriber/resource/parser.rb', line 4 def parse!(input, = {}) parse(input, .merge(fail: true)) end |