class PackList::DSL::CategoryBuilder

Public Class Methods

new(name, description, &block) click to toggle source
# 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

Public Instance Methods

build() click to toggle source
# File lib/packlist/dsl.rb, line 64
def build
  @category
end
consumable(name, description, weight=:oz, quantity=1) click to toggle source
# File lib/packlist/dsl.rb, line 58
def consumable(name, description, weight=:oz, quantity=1)
  add_item(name, description, weight, :consumable, quantity)
end
Also aliased as: food
food(name, description, weight=:oz, quantity=1)
Alias for: consumable
item(name, description, weight, quantity=1) click to toggle source
# 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) click to toggle source
# File lib/packlist/dsl.rb, line 54
def worn(name, description, weight, quantity=1)
  add_item(name, description, weight, :worn, quantity)
end

Private Instance Methods

add_item(name, description, weight, type, quantity) click to toggle source
# File lib/packlist/dsl.rb, line 70
def add_item(name, description, weight, type, quantity)
  item = Item.new(name, description, weight, type, quantity: quantity)
  @category << item
end