Class: Corraios::Containers::Envelope
- Inherits:
-
Base
- Object
- Base
- Corraios::Containers::Envelope
show all
- Defined in:
- lib/corraios/containers/envelope.rb
Instance Method Summary
collapse
Methods inherited from Base
add_attribute, #assert_minimum_measures!, #attributes_names, attributes_restrictions, floor_for, #format, #initialize, #is_a?, minimum_value_for, query_attribute_name, query_attribute_names, set_format, #to_query_params, #valid?, valid_field?, valid_fields?
Instance Method Details
#can_merge?(envelope) ⇒ Boolean
11
12
13
14
15
|
# File 'lib/corraios/containers/envelope.rb', line 11
def can_merge?(envelope)
new_weight = self.weight + envelope.weight
self.class.valid_field? :weight, new_weight
end
|
#merge!(other) ⇒ Object
17
18
19
20
|
# File 'lib/corraios/containers/envelope.rb', line 17
def merge!(other)
self.weight += other.weight
end
|
#to_package ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/corraios/containers/envelope.rb', line 22
def to_package
Package.new(weight: self.weight,
height: 2,
width: Package::floor_for(:width, self.width),
length: Package::floor_for(:length, self.length)
)
end
|