Class: Pasture::API

Inherits:
Sinatra::Base
  • Object
show all
Includes:
Cowsay
Defined in:
lib/pasture/api.rb

Instance Method Summary collapse

Constructor Details

#initializeAPI

Returns a new instance of API.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/pasture/api.rb', line 12

def initialize
  super()
  puts settings.pasture_options[:db]
  puts 'true' if settings.pasture_options[:db]
  if settings.pasture_options[:db]
  @conn = Sequel.connect(settings.pasture_options[:db])
    unless @conn.table_exists?(:sayings)
      @conn.create_table :sayings do
        primary_key :id
        String :message
      end
    end
  end
end