lib/aixm/w.rb in aixm-1.0.0 vs lib/aixm/w.rb in aixm-1.1.0
- old
+ new
@@ -36,11 +36,11 @@
%Q(#<#{self.class} #{to_s}>)
end
# @return [String] human readable representation (e.g. "123 t")
def to_s
- [wgt, unit].join(' ')
+ [wgt, unit].join(' '.freeze)
end
def wgt=(value)
fail(ArgumentError, "invalid wgt") unless value.is_a?(Numeric) && value >= 0
@wgt = value.to_f
@@ -54,9 +54,10 @@
# @!method to_kg
# @!method to_t
# @!method to_lb
# @!method to_ton
+ #
# @return [AIXM::W] convert weight
UNITS.each_key do |target_unit|
define_method "to_#{target_unit}" do
return self if unit == target_unit
self.class.new((wgt * UNITS[unit][target_unit]).round(8), target_unit)