Module: WineDb
- Defined in:
- lib/winedb.rb,
lib/winedb/reader.rb,
lib/winedb/schema.rb,
lib/winedb/version.rb,
lib/winedb/models/shop.rb,
lib/winedb/models/wine.rb,
lib/winedb/models/grape.rb,
lib/winedb/models/family.rb,
lib/winedb/models/tavern.rb,
lib/winedb/models/winery.rb,
lib/winedb/models/forward.rb,
lib/winedb/models/variety.rb,
lib/winedb/models/vintage.rb,
lib/winedb/models/vineyard.rb
Defined Under Namespace
Modules: Matcher, Model
Classes: CreateDb, Reader
Constant Summary
collapse
- VERSION =
'0.1.6'
- Models =
note: for convenciene (and compatibility) add alias Models for Model namespace
e.g lets you use include WineDb::Models
Model
Class Method Summary
collapse
Class Method Details
.banner ⇒ Object
42
43
44
|
# File 'lib/winedb.rb', line 42
def self.banner
"winedb/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
end
|
.data_path ⇒ Object
50
51
52
|
# File 'lib/winedb.rb', line 50
def self.data_path
"#{root}/data"
end
|
.read(ary, include_path) ⇒ Object
62
63
64
65
66
67
|
# File 'lib/winedb.rb', line 62
def self.read( ary, include_path )
reader = Reader.new( include_path )
ary.each do |name|
reader.load( name )
end
end
|
.read_all(include_path, opts = {}) ⇒ Object
load all builtins (using plain text reader); helper for convenience
74
75
76
|
# File 'lib/winedb.rb', line 74
def self.read_all( include_path, opts={} ) read_setup( 'setups/all', include_path, opts )
end
|
.read_builtin ⇒ Object
78
79
80
|
# File 'lib/winedb.rb', line 78
def self.read_builtin
read_setup( 'setups/all', data_path )
end
|
.read_setup(setup, include_path, opts = {}) ⇒ Object
69
70
71
72
|
# File 'lib/winedb.rb', line 69
def self.read_setup( setup, include_path, opts={} )
reader = Reader.new( include_path, opts )
reader.load_setup( setup )
end
|
.root ⇒ Object
46
47
48
|
# File 'lib/winedb.rb', line 46
def self.root
"#{File.expand_path( File.dirname(File.dirname(__FILE__)) )}"
end
|
.tables ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
106
|
# File 'lib/winedb.rb', line 95
def self.tables
puts " #{Model::Grape.count} grapes"
puts " #{Model::Family.count} (wine) families"
puts " #{Model::Variety.count} (wine) varieties"
puts " #{Model::Vineyard.count} vineyards"
puts " #{Model::Shop.count} shops (vinothek/enotecia)"
puts " #{Model::Tavern.count} taverns (heurige)"
puts " #{Model::Vintage.count} vintages"
puts " #{Model::Wine.count} wines"
puts " #{Model::Winery.count} wineries"
end
|