Class: JA2R::Parser
- Inherits:
-
Object
- Object
- JA2R::Parser
- Defined in:
- lib/ja2r/parser.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(hash, options = {}) ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
#initialize(hash, options = {}) ⇒ Parser
Returns a new instance of Parser.
3 4 5 6 7 |
# File 'lib/ja2r/parser.rb', line 3 def initialize(hash, = {}) @hash = hash @options = @object_space = [] end |
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ja2r/parser.rb', line 9 def call data = parse_data raise InvalidData.new('Hash does not appear to be valid json-api', @hash) unless data parse_included object_space.each do |object| assign_relationships object, object_map end data end |