Class: JSON::SchemaDsl::Renderers::Base Abstract
- Inherits:
-
Object
- Object
- JSON::SchemaDsl::Renderers::Base
- Defined in:
- lib/json/schema_dsl/renderers/base.rb
Overview
This class is abstract.
The abstract base renderer that provides common behaviour to all renderers like the depth-first-traversal and access to the scope.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Instance Method Summary collapse
-
#initialize(scope) ⇒ Base
constructor
A new instance of Base.
-
#traverse(entity) ⇒ Hash
The hash-tree with all values visited.
Constructor Details
#initialize(scope) ⇒ Base
Returns a new instance of Base.
13 14 15 |
# File 'lib/json/schema_dsl/renderers/base.rb', line 13 def initialize(scope) @scope = scope end |
Instance Attribute Details
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
11 12 13 |
# File 'lib/json/schema_dsl/renderers/base.rb', line 11 def scope @scope end |
Instance Method Details
#traverse(entity) ⇒ Hash
Returns The hash-tree with all values visited.
21 22 23 |
# File 'lib/json/schema_dsl/renderers/base.rb', line 21 def traverse(entity) entity.transform_values { |v| step(v) } end |