Class: Val
Defined Under Namespace
Modules: DSL, Op Classes: ArrayCondition, Key
Constant Summary collapse
- Bool =
new { OR(true, false) }
Instance Method Summary collapse
- #===(value) ⇒ Object
-
#initialize(&block) ⇒ Val
constructor
A new instance of Val.
Methods included from DSL
#OR, #is, #is_a, #key, #m, #val
Constructor Details
#initialize(&block) ⇒ Val
Returns a new instance of Val.
60 61 62 63 64 65 66 67 |
# File 'lib/val.rb', line 60 def initialize &block @conditions = [] result = instance_exec &block if @conditions.empty? condition = result @conditions << condition end end |
Instance Method Details
#===(value) ⇒ Object
69 70 71 |
# File 'lib/val.rb', line 69 def === value @conditions.all? &[:===, value] end |