Class: Val

Inherits:
Object
  • Object
show all
Includes:
DSL
Defined in:
lib/val.rb

Defined Under Namespace

Modules: DSL, Op Classes: ArrayCondition, Key

Constant Summary collapse

Bool =
new { OR(true, false) }

Instance Method Summary collapse

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