Class: RIO::Match::Entry::List

Inherits:
Object
  • Object
show all
Extended by:
Fwd
Defined in:
lib/rio/entrysel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Fwd

fwd, fwd_reader, fwd_readers, fwd_writer, fwd_writers

Constructor Details

#initialize(sym, *args) ⇒ List

Returns a new instance of List.



116
117
118
119
# File 'lib/rio/entrysel.rb', line 116

def initialize(sym,*args)
  @sym = sym
  @list = args.map { |arg| Match::Entry.create(arg) }
end

Instance Attribute Details

#listObject

Returns the value of attribute list.



115
116
117
# File 'lib/rio/entrysel.rb', line 115

def list
  @list
end

#symObject (readonly)

Returns the value of attribute sym.



114
115
116
# File 'lib/rio/entrysel.rb', line 114

def sym
  @sym
end

Instance Method Details

#<<(el) ⇒ Object



123
124
125
# File 'lib/rio/entrysel.rb', line 123

def <<(el)
  @list << el
end

#===(me_list) ⇒ Object



126
127
128
# File 'lib/rio/entrysel.rb', line 126

def ===(me_list)
  @sym == me_list.sym
end

#=~(el) ⇒ Object



129
130
131
# File 'lib/rio/entrysel.rb', line 129

def =~(el)
  el.__send__(@sym) and (@list.empty? or @list.detect { |sel| sel =~ el })
end

#callstr(func, *args) ⇒ Object



134
135
136
# File 'lib/rio/entrysel.rb', line 134

def callstr(func,*args)
  self.class.to_s+'['+self.to_s+']'+'.'+func.to_s+'('+args.join(',')+')'
end

#inspectObject



120
121
122
# File 'lib/rio/entrysel.rb', line 120

def inspect()
  @sym.to_s+"("+@list.inspect+")"
end