Class: PackList::DSL::CategoryBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/packlist/dsl.rb

Instance Method Summary collapse

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

#buildObject



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