Class: Schemacop::V3::CombinationNode Abstract

Inherits:
Node
  • Object
show all
Defined in:
lib/schemacop/v3/combination_node.rb

Overview

This class is abstract.

Direct Known Subclasses

AllOfNode, AnyOfNode, IsNotNode, OneOfNode

Instance Attribute Summary

Attributes inherited from Node

#as, #default, #description, #name, #options, #parent, #require_key, #title

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

allowed_options, #allowed_types, #children, create, #create, #dsl_node, #dsl_scm, #initialize, #require_key?, #required?, resolve_class, #schemas, supports_children, supports_children_options, #used_external_schemas, #validate

Constructor Details

This class inherits a constructor from Schemacop::V3::Node

Class Method Details

.dsl_methodsObject



5
6
7
# File 'lib/schemacop/v3/combination_node.rb', line 5

def self.dsl_methods
  super + NodeRegistry.dsl_methods(false)
end

Instance Method Details

#add_child(node) ⇒ Object



26
27
28
# File 'lib/schemacop/v3/combination_node.rb', line 26

def add_child(node)
  @items << node
end

#as_jsonObject



15
16
17
# File 'lib/schemacop/v3/combination_node.rb', line 15

def as_json
  process_json([], type => @items.map(&:as_json))
end

#cast(value) ⇒ Object



19
20
21
22
23
24
# File 'lib/schemacop/v3/combination_node.rb', line 19

def cast(value)
  item = match(value)
  return value unless item

  return item.cast(value)
end

#initObject



11
12
13
# File 'lib/schemacop/v3/combination_node.rb', line 11

def init
  @items = []
end