Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/libsessho.rb

Instance Method Summary collapse

Instance Method Details

#intersect(sa) ⇒ Object



64
# File 'lib/libsessho.rb', line 64

def intersect(sa);self.select{|i|sa.include?(i)};end

#matches(s) ⇒ Object



73
74
75
76
77
# File 'lib/libsessho.rb', line 73

def matches(s)
	matcharr = Array.new
	self.each_with_index{|c,i|c==s&&matcharr<<i}
	return matcharr
end

#subarr(pos) ⇒ Object

Raises:

  • (ArgumentError)


65
66
67
68
# File 'lib/libsessho.rb', line 65

def subarr(pos)
	raise ArgumentError,"Index out of range" if pos>=self.length
	self[pos,self.length]
end

#suparr(pos) ⇒ Object

Raises:

  • (ArgumentError)


69
70
71
72
# File 'lib/libsessho.rb', line 69

def suparr(pos)
	raise ArgumentError,"Index out of range" if pos>=self.length
	self[0,pos]
end