class PackList::PackList
Attributes
categories[R]
description[RW]
name[RW]
Public Class Methods
new(name, description=nil, categories=[])
click to toggle source
# File lib/packlist/model.rb, line 139 def initialize(name, description=nil, categories=[]) @name, @description = name, description @categories = categories end
Public Instance Methods
base_weight()
click to toggle source
# File lib/packlist/model.rb, line 161 def base_weight @categories.collect {|category| category.base_weight}.reduce(Weight::ZERO, :+) end
consumable_weight()
click to toggle source
# File lib/packlist/model.rb, line 157 def consumable_weight @categories.collect {|category| category.consumable_weight}.reduce(Weight::ZERO, :+) end
item_count()
click to toggle source
# File lib/packlist/model.rb, line 169 def item_count @categories.collect {|category| category.item_count}.reduce(0, :+) end
total_pack_weight()
click to toggle source
# File lib/packlist/model.rb, line 149 def total_pack_weight base_weight + consumable_weight end
total_quantity()
click to toggle source
# File lib/packlist/model.rb, line 165 def total_quantity @categories.collect {|category| category.total_quantity}.reduce(0, :+) end
total_weight()
click to toggle source
# File lib/packlist/model.rb, line 145 def total_weight @categories.collect {|category| category.total_weight}.reduce(Weight::ZERO, :+) end
worn_weight()
click to toggle source
# File lib/packlist/model.rb, line 153 def worn_weight @categories.collect {|category| category.worn_weight}.reduce(Weight::ZERO, :+) end