Class: Val

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

Defined Under Namespace

Modules: CoreExt, DSL Classes: Claim, Instance, Key, Message

Constant Summary collapse

Bool =
new { OR(true, false) }
NotNil =
new { NOT :nil? }

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DSL

#NOT, #OR, #is, #is_a, #key, #m, #val

Constructor Details

#initialize(&block) ⇒ Val

Returns a new instance of Val.



44
45
46
47
# File 'lib/val.rb', line 44

def initialize &block
  @claims = []
  instance_exec &block if block_given?
end

Instance Attribute Details

#claimsObject (readonly)

Returns the value of attribute claims.



49
50
51
# File 'lib/val.rb', line 49

def claims
  @claims
end

Instance Method Details

#===(value) ⇒ Object



55
56
57
# File 'lib/val.rb', line 55

def === value
  claims.all? &[:===, value]
end

#[](value) ⇒ Object



59
60
61
# File 'lib/val.rb', line 59

def [] value
  Instance.new self, value
end

#to_valObject



51
52
53
# File 'lib/val.rb', line 51

def to_val
  self
end