Class: Predicated::Constraint
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#selectors ⇒ Object
readonly
Returns the value of attribute selectors.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #check(predicate, ancestors) ⇒ Object
-
#initialize(args) ⇒ Constraint
constructor
A new instance of Constraint.
Constructor Details
#initialize(args) ⇒ Constraint
Returns a new instance of Constraint.
35 36 37 38 39 |
# File 'lib/predicated/constrain.rb', line 35 def initialize(args) @name = args[:name] @selectors = args[:selectors] || [:all] @check_that = args[:check_that] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
34 35 36 |
# File 'lib/predicated/constrain.rb', line 34 def name @name end |
#selectors ⇒ Object (readonly)
Returns the value of attribute selectors.
34 35 36 |
# File 'lib/predicated/constrain.rb', line 34 def selectors @selectors end |
Instance Method Details
#==(other) ⇒ Object
45 46 47 |
# File 'lib/predicated/constrain.rb', line 45 def ==(other) @name == other.name && @selectors == other.selectors end |
#check(predicate, ancestors) ⇒ Object
41 42 43 |
# File 'lib/predicated/constrain.rb', line 41 def check(predicate, ancestors) @check_that.call(predicate, ancestors) end |