Class: YES::Constraints::NodeConstraint
- Inherits:
-
AbstractConstraint
- Object
- AbstractConstraint
- YES::Constraints::NodeConstraint
- Defined in:
- lib/yes/constraints/node_constraint.rb
Overview
The NodeConstraint class is an abstract class and used for create constraint subclasses that apply constraints on a sigle node.
Direct Known Subclasses
Choice, FNMatch, Key, Kind, Length, Range, Regexp, Requires, Tag, Type, Value
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
YAML Node.
Attributes inherited from AbstractConstraint
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(spec, tree, node) ⇒ NodeConstraint
constructor
Like Abstract#initialize but takes a ‘node` qas well.
-
#tag ⇒ Object
Get the applicable node’s tag.
-
#value ⇒ Object
Get the applicable node’s value.
Methods inherited from AbstractConstraint
#applicable?, checklist, inherited, #match_delta, #recurse_valid?, #valid?, #validate
Constructor Details
#initialize(spec, tree, node) ⇒ NodeConstraint
Like Abstract#initialize but takes a ‘node` qas well.
12 13 14 15 |
# File 'lib/yes/constraints/node_constraint.rb', line 12 def initialize(spec, tree, node) super(spec, tree, [node]) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
YAML Node.
20 21 22 |
# File 'lib/yes/constraints/node_constraint.rb', line 20 def node @node end |
Class Method Details
.applicable?(spec) ⇒ Boolean
47 48 49 |
# File 'lib/yes/constraints/node_constraint.rb', line 47 def self.applicable?(spec) false end |
Instance Method Details
#tag ⇒ Object
Get the applicable node’s tag.
23 24 25 |
# File 'lib/yes/constraints/node_constraint.rb', line 23 def tag node.type_id end |
#value ⇒ Object
Get the applicable node’s value.
28 29 30 |
# File 'lib/yes/constraints/node_constraint.rb', line 28 def value node.value end |