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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sym, *args) ⇒ List

Returns a new instance of List.



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

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.



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

def list
  @list
end

#symObject (readonly)

Returns the value of attribute sym.



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

def sym
  @sym
end

Instance Method Details

#<<(el) ⇒ Object



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

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

#===(me_list) ⇒ Object



137
138
139
# File 'lib/rio/entrysel.rb', line 137

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

#=~(el) ⇒ Object



140
141
142
# File 'lib/rio/entrysel.rb', line 140

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

#callstr(func, *args) ⇒ Object



145
146
147
# File 'lib/rio/entrysel.rb', line 145

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

#inspectObject



131
132
133
# File 'lib/rio/entrysel.rb', line 131

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