class Array
Public Instance Methods
alt_scan(item)
click to toggle source
# File lib/random_methods.rb, line 47 def alt_scan(item) # test array for a substring, if string contains substring return the string self.each do |var| begin if var[item] then return var end rescue return nil end end end
bool_scan(item)
click to toggle source
# File lib/random_methods.rb, line 59 def bool_scan(item) self.each do |var| begin if var == item then return true end rescue return false end end end
print_all()
click to toggle source
# File lib/random_methods.rb, line 34 def print_all self.each do |item| print "#{item} " end end
puts_all()
click to toggle source
# File lib/random_methods.rb, line 29 def puts_all self.each do |item| puts item end end
write_all(file)
click to toggle source
# File lib/random_methods.rb, line 39 def write_all(file) somefile = open(file, 'a') self.each do |item| somefile.puts(item) end somefile.close end