Class: HalInterpretation::ItemInterpreter

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/hal_interpretation/item_interpreter.rb

Instance Method Summary collapse

Constructor Details

#initialize(a_representation, opts) ⇒ ItemInterpreter

opts - named args

:location - 
:interpreter -


6
7
8
9
10
11
# File 'lib/hal_interpretation/item_interpreter.rb', line 6

def initialize(a_representation, opts)
  @repr = a_representation
  @location = opts.fetch(:location) { fail ArgumentError, "location is required" }
  @problems = []
  @interpreter = opts.fetch(:interpreter) { fail ArgumentError, "interpreter is required" }
end

Instance Method Details

#itemsObject



13
14
15
16
17
18
19
# File 'lib/hal_interpretation/item_interpreter.rb', line 13

def items
  interpret unless done?

  (raise InvalidRepresentationError.new problems) if problems.any?

  @items
end

#problemsObject



21
22
23
24
25
# File 'lib/hal_interpretation/item_interpreter.rb', line 21

def problems
  interpret unless done?

  @problems
end