class Corraios::Containers::Roll
Public Class Methods
valid_fields?(attributes)
click to toggle source
Calls superclass method
Corraios::Containers::Base::valid_fields?
# File lib/corraios/containers/roll.rb, line 34 def valid_fields?(attributes) super(attributes) && (attributes[:diameter] * 2 + attributes[:length]) <= 200.0 end
Public Instance Methods
can_merge?(other)
click to toggle source
# File lib/corraios/containers/roll.rb, line 11 def can_merge?(other) false end
merge!(other)
click to toggle source
# File lib/corraios/containers/roll.rb, line 15 def merge!(other) raise NotImplementedError end
to_package()
click to toggle source
# File lib/corraios/containers/roll.rb, line 23 def to_package Package.new( weight: self.weight, height: Package::floor_for(:height, self.diameter), width: Package::floor_for(:width, self.diameter), length: Package::floor_for(:length, self.length) ) end
volume()
click to toggle source
# File lib/corraios/containers/roll.rb, line 19 def volume 3.1415 * (diameter/2)**2 * length end