Class: Val::Message

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

Defined Under Namespace

Classes: Arrow, Instance

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Message

Returns a new instance of Message.



205
206
207
208
# File 'lib/val.rb', line 205

def initialize name
  @name = name
  @arrows = []
end

Instance Attribute Details

#arrowsObject (readonly)

Returns the value of attribute arrows.



210
211
212
# File 'lib/val.rb', line 210

def arrows
  @arrows
end

#nameObject (readonly)

Returns the value of attribute name.



210
211
212
# File 'lib/val.rb', line 210

def name
  @name
end

Instance Method Details

#===(value) ⇒ Object



216
217
218
# File 'lib/val.rb', line 216

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

#[](value) ⇒ Object



220
221
222
# File 'lib/val.rb', line 220

def [] value
  Instance.new self, value
end

#arrow(&block) ⇒ Object



212
213
214
# File 'lib/val.rb', line 212

def arrow &block
  @arrows << Arrow.new(@name, &block)
end