Module: Oculus

Extended by:
Oculus
Included in:
Oculus
Defined in:
lib/oculus.rb,
lib/oculus/query.rb,
lib/oculus/server.rb,
lib/oculus/storage.rb,
lib/oculus/version.rb,
lib/oculus/connection.rb,
lib/oculus/connection/mysql2.rb,
lib/oculus/storage/file_store.rb,
lib/oculus/connection/postgres.rb,
lib/oculus/presenters/query_presenter.rb

Defined Under Namespace

Modules: Connection, Presenters, Storage Classes: Query, Server

Constant Summary collapse

DEFAULT_CONNECTION_OPTIONS =
{ :adapter => 'mysql', :host => 'localhost' }
VERSION =
"0.9.1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cache_pathObject



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

def cache_path
  @cache_path ||= 'tmp/data'
end

#connection_optionsObject



25
26
27
# File 'lib/oculus.rb', line 25

def connection_options
  @connection_options ||= DEFAULT_CONNECTION_OPTIONS
end

#data_storeObject



19
20
21
# File 'lib/oculus.rb', line 19

def data_store
  @data_store ||= Oculus::Storage::FileStore.new(Oculus.cache_path)
end

Instance Method Details

#connection_stringObject



29
30
31
32
33
# File 'lib/oculus.rb', line 29

def connection_string
  user = "#{connection_options[:username]}@" if connection_options[:username]
  port = ":#{connection_options[:port]}" if connection_options[:port]
  "#{connection_options[:adapter]}://#{user}#{connection_options[:host]}#{port}/#{connection_options[:database]}"
end