Class: PackList::DSL::CategoryBuilder
- Inherits:
-
Object
- Object
- PackList::DSL::CategoryBuilder
- Defined in:
- lib/packlist/dsl.rb
Instance Method Summary collapse
- #build ⇒ Object
- #consumable(name, description, weight = :oz, quantity = 1) ⇒ Object (also: #food)
-
#initialize(name, description, &block) ⇒ CategoryBuilder
constructor
A new instance of CategoryBuilder.
- #item(name, description, weight, quantity = 1) ⇒ Object
- #worn(name, description, weight, quantity = 1) ⇒ Object
Constructor Details
#initialize(name, description, &block) ⇒ CategoryBuilder
Returns a new instance of CategoryBuilder.
43 44 45 46 47 48 |
# File 'lib/packlist/dsl.rb', line 43 def initialize(name, description, &block) @category = Category.new name, description if block_given? instance_eval(&block) end end |
Instance Method Details
#build ⇒ Object
64 65 66 |
# File 'lib/packlist/dsl.rb', line 64 def build @category end |
#consumable(name, description, weight = :oz, quantity = 1) ⇒ Object Also known as: food
58 59 60 |
# File 'lib/packlist/dsl.rb', line 58 def consumable(name, description, weight=:oz, quantity=1) add_item(name, description, weight, :consumable, quantity) end |
#item(name, description, weight, quantity = 1) ⇒ Object
50 51 52 |
# File 'lib/packlist/dsl.rb', line 50 def item(name, description, weight, quantity=1) add_item(name, description, weight, :item, quantity) end |
#worn(name, description, weight, quantity = 1) ⇒ Object
54 55 56 |
# File 'lib/packlist/dsl.rb', line 54 def worn(name, description, weight, quantity=1) add_item(name, description, weight, :worn, quantity) end |