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.4'- 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
- .banner ⇒ Object
- .create ⇒ Object
-
.delete! ⇒ Object
method read_all.
- .read(ary, include_path) ⇒ Object
-
.read_all(include_path, opts = {}) ⇒ Object
load all builtins (using plain text reader); helper for convenience.
- .read_setup(setup, include_path, opts = {}) ⇒ Object
- .root ⇒ Object
- .tables ⇒ Object
Class Method Details
.banner ⇒ Object
42 43 44 |
# File 'lib/winedb.rb', line 42 def self. "winedb/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]" end |
.create ⇒ Object
50 51 52 53 54 |
# File 'lib/winedb.rb', line 50 def self.create CreateDb.new.up WineDb::Model::Prop.create!( key: 'db.schema.wine.version', value: VERSION ) end |
.delete! ⇒ Object
method read_all
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/winedb.rb', line 73 def self.delete! ## fix/todo: move into deleter class (see worlddb,sportdb etc.) Model::Grape.delete_all Model::Family.delete_all Model::Variety.delete_all Model::Vineyard.delete_all Model::Shop.delete_all Model::Tavern.delete_all Model::Vintage.delete_all Model::Wine.delete_all Model::Winery.delete_all end |
.read(ary, include_path) ⇒ Object
57 58 59 60 61 62 |
# File 'lib/winedb.rb', line 57 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
69 70 71 |
# File 'lib/winedb.rb', line 69 def self.read_all( include_path, opts={} ) # load all builtins (using plain text reader); helper for convenience read_setup( 'setups/all', include_path, opts ) end |
.read_setup(setup, include_path, opts = {}) ⇒ Object
64 65 66 67 |
# File 'lib/winedb.rb', line 64 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.( File.dirname(File.dirname(__FILE__)) )}" end |
.tables ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/winedb.rb', line 86 def self.tables ## fix/todo: move into stats class (see worlddb,sportdb etc.) 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 |