Class: JPie::Serializer::IncludeProcessor
- Inherits:
-
Object
- Object
- JPie::Serializer::IncludeProcessor
- Defined in:
- lib/jpie/serializer.rb
Overview
Helper class to manage include processing state and reduce parameter passing
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#included ⇒ Object
readonly
Returns the value of attribute included.
-
#processed_includes ⇒ Object
readonly
Returns the value of attribute processed_includes.
-
#serializer ⇒ Object
readonly
Returns the value of attribute serializer.
Instance Method Summary collapse
-
#initialize(serializer, context) ⇒ IncludeProcessor
constructor
A new instance of IncludeProcessor.
- #process(resources, includes) ⇒ Object
Constructor Details
#initialize(serializer, context) ⇒ IncludeProcessor
Returns a new instance of IncludeProcessor.
113 114 115 116 117 118 |
# File 'lib/jpie/serializer.rb', line 113 def initialize(serializer, context) @serializer = serializer @context = context @included = [] @processed_includes = {} end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
111 112 113 |
# File 'lib/jpie/serializer.rb', line 111 def context @context end |
#included ⇒ Object (readonly)
Returns the value of attribute included.
111 112 113 |
# File 'lib/jpie/serializer.rb', line 111 def included @included end |
#processed_includes ⇒ Object (readonly)
Returns the value of attribute processed_includes.
111 112 113 |
# File 'lib/jpie/serializer.rb', line 111 def processed_includes @processed_includes end |
#serializer ⇒ Object (readonly)
Returns the value of attribute serializer.
111 112 113 |
# File 'lib/jpie/serializer.rb', line 111 def serializer @serializer end |
Instance Method Details
#process(resources, includes) ⇒ Object
120 121 122 123 124 125 126 |
# File 'lib/jpie/serializer.rb', line 120 def process(resources, includes) parsed_includes = serializer.send(:parse_nested_includes, includes) parsed_includes.each do |include_name, nested_includes| process_single_include(include_name, nested_includes, resources) end included end |