class Schemacop::V3::CombinationNode
@abstract
Public Class Methods
dsl_methods()
click to toggle source
Calls superclass method
# File lib/schemacop/v3/combination_node.rb, line 5 def self.dsl_methods super + NodeRegistry.dsl_methods(false) end
Public Instance Methods
add_child(node)
click to toggle source
# File lib/schemacop/v3/combination_node.rb, line 26 def add_child(node) @items << node end
as_json()
click to toggle source
# File lib/schemacop/v3/combination_node.rb, line 15 def as_json process_json([], type => @items.map(&:as_json)) end
cast(value)
click to toggle source
# File lib/schemacop/v3/combination_node.rb, line 19 def cast(value) item = match(value) return value unless item return item.cast(value) end
init()
click to toggle source
# File lib/schemacop/v3/combination_node.rb, line 11 def init @items = [] end
Protected Instance Methods
match(data)
click to toggle source
# File lib/schemacop/v3/combination_node.rb, line 36 def match(data) matches(data).first end
matches(data)
click to toggle source
# File lib/schemacop/v3/combination_node.rb, line 40 def matches(data) @items.select { |i| item_matches?(i, data) } end
type()
click to toggle source
# File lib/schemacop/v3/combination_node.rb, line 32 def type fail NotImplementedError end