class PackList::Item
Attributes
description[RW]
name[RW]
quantity[RW]
weight[RW]
Public Class Methods
new(name, description, weight, type=nil, quantity: 1)
click to toggle source
# File lib/packlist/model.rb, line 66 def initialize(name, description, weight, type=nil, quantity: 1) @name, @description, @quantity, @type = name, description, quantity, type @weight = weight.respond_to?(:units) ? weight : Weight.new(weight, :oz) end
Public Instance Methods
consumable?()
click to toggle source
# File lib/packlist/model.rb, line 79 def consumable? return @type == :consumable end
total_weight()
click to toggle source
# File lib/packlist/model.rb, line 71 def total_weight return @weight * @quantity end
worn?()
click to toggle source
# File lib/packlist/model.rb, line 75 def worn? return @type == :worn end