Class: Teebo::Base

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

Direct Known Subclasses

Name

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



7
8
9
10
11
# File 'lib/teebo.rb', line 7

def initialize
  # Initialize the database
  @@database = SQLite3::Database.new "lib/data/seed-data.db"
  @@database.results_as_hash = true
end

Instance Method Details

#update_sum_countObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/teebo.rb', line 17

def update_sum_count
  sexes = ['M', 'F']
  sexes.each do |sex|
    get_rows = "      select * from given_names where sex = ?\n    SQL\n\n    put_count_to = <<-SQL\n      update given_names set count_to = ? where id = ?\n    SQL\n\n    count = 0\n    @database.execute(get_rows, sex) do |row|\n      count += row['count']\n      database.execute(put_count_to, count, row[0])\n    end\n  end\nend\n"

#weightObject



13
14
15
# File 'lib/teebo.rb', line 13

def weight

end