Class: Val::Key

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

Defined Under Namespace

Classes: Instance

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, condition) ⇒ Key

Returns a new instance of Key.



173
174
175
# File 'lib/val.rb', line 173

def initialize name, condition
  @name, @type = name, condition.to_val
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



171
172
173
# File 'lib/val.rb', line 171

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



171
172
173
# File 'lib/val.rb', line 171

def type
  @type
end

Instance Method Details

#===(value) ⇒ Object



177
178
179
# File 'lib/val.rb', line 177

def === value
  self[value].ok?
end

#[](it) ⇒ Object



181
182
183
# File 'lib/val.rb', line 181

def [] it
  Instance.new self, it
end