Module: HalInterpretation
- Extended by:
- Forwardable
- Defined in:
- lib/hal_interpretation.rb,
lib/hal_interpretation/dsl.rb,
lib/hal_interpretation/errors.rb,
lib/hal_interpretation/version.rb,
lib/hal_interpretation/extractor.rb,
lib/hal_interpretation/item_interpreter.rb
Overview
Declarative interpretation of HAL documents into ActiveModel style objects.
Defined Under Namespace
Modules: ClassMethods, Dsl Classes: Extractor, InvalidRepresentationError, ItemInterpreter
Constant Summary collapse
- Error =
Class.new(StandardError)
- VERSION =
"1.1.1"
Instance Method Summary collapse
-
#items ⇒ Object
Returns array of models created from the HAL representation we are interpreting.
-
#problems ⇒ Object
Returns array of problems messages, or empty array if there are none.
Instance Method Details
#items ⇒ Object
Returns array of models created from the HAL representation we are interpreting.
Raises InvalidRepresentationError if any of the models are invalid
or the representation is not a HAL document.
14 15 16 17 18 |
# File 'lib/hal_interpretation.rb', line 14 def items (fail InvalidRepresentationError.new(problems)) if problems.any? @observations ||= interpreters.flat_map(&:items) end |
#problems ⇒ Object
Returns array of problems messages, or empty array if there are none. This will do a complete interpretation of the representation if it has not already been done.
23 24 25 |
# File 'lib/hal_interpretation.rb', line 23 def problems @problems ||= interpreters.flat_map(&:problems) end |