Class: JSON::SchemaDsl::Renderers::Base Abstract

Inherits:
Object
  • Object
show all
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

Alias, Desugar, Filter, Multiplexer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scope) ⇒ Base



13
14
15
# File 'lib/json/schema_dsl/renderers/base.rb', line 13

def initialize(scope)
  @scope = scope
end

Instance Attribute Details

#scopeObject (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



21
22
23
# File 'lib/json/schema_dsl/renderers/base.rb', line 21

def traverse(entity)
  entity.transform_values { |v| step(v) }
end