Module: Sequel::Plugins::Units::ClassMethods

Defined in:
lib/sequel/plugins/units/class_methods.rb

Instance Method Summary collapse

Instance Method Details

#value_with_unit(method_name) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/sequel/plugins/units/class_methods.rb', line 5

def value_with_unit(method_name)
  define_method method_name do
    scalar = _validate_scalar(send("#{method_name}_scalar".to_sym))
    unit = _validate_unit(send("#{method_name}_unit".to_sym))
    Unit.new("#{scalar} #{unit}")
  end
end