Class: DBA::Select

Inherits:
Command show all
Defined in:
lib/dba/select.rb

Instance Attribute Summary

Attributes inherited from Command

#database, #table_name

Instance Method Summary collapse

Methods inherited from Command

arity_check, #initialize

Constructor Details

This class inherits a constructor from DBA::Command

Instance Method Details

#call(table, column, value) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/dba/select.rb', line 2

def call(table, column, value)
  self.table_name = table

  column_name = column.to_sym

  rows = database[table_name].where(column_name => value)

  rows.each do |row|
    printer.print(row)
    printer.print_line
  end
end