x.matches(/something.*/) will match all of one line. To match all lines
x.matches(/something.*/m) you need to put the 'm'.Nice!
I found it here.
Nigel Thorne's software development blog, focusing on finding simple solutions to real work problems.
x.matches(/something.*/) will match all of one line. x.matches(/something.*/m) you need to put the 'm'.
table = <<-TABLE
...paste table here...
TABLE
rows = (table.split "\n").collect { |line| line.split("|") }
puts (0.. rows[1].length).each { |col| puts "|#{rows.collect{ |row| row[col] }.join("|")}|" }
# First create an database object
database = Rddb::Database.new
# Put some documents into it
database << {:name => 'John', :income => 35000}
database << {:name => 'Bob', :income => 40000}
database << {:name => 'Jim', :income => 37000}
# Create a view that will return the names
database.create_view('names') do |document, args|
document.name
end
# The result of querying will return an array of names
assert_equal ['John','Bob','Jim'], database.query('names')