Module: Boutique
- Defined in:
- lib/boutique.rb
Defined Under Namespace
Classes: App, Config, Product, ProductBuilder, Purchase
Constant Summary
collapse
- VERSION =
'0.0.8'
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
29
30
31
|
# File 'lib/boutique.rb', line 29
def config
Config
end
|
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/boutique.rb', line 18
def configure(setup_db=true)
yield Config
DataMapper.setup(:default,
:adapter => config.db_adapter,
:host => config.db_host,
:username => config.db_username,
:password => config.db_password,
:database => config.db_database
) if setup_db
end
|
.product(code) {|builder| ... } ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/boutique.rb', line 33
def product(code)
builder = ProductBuilder.new
builder.code(code)
yield builder
product = Product.first_or_create({:code => code}, builder.to_hash)
product.save
product
end
|