Class: Quantify::Unit::NonSI
- Defined in:
- lib/quantify/unit/non_si_unit.rb
Instance Attribute Summary
Attributes inherited from Base
#acts_as_alternative_unit, #acts_as_equivalent_unit, #base_unit, #dimensions, #factor, #label, #name, #prefix, #symbol
Instance Method Summary collapse
-
#initialize(options = nil) ⇒ NonSI
constructor
Additional initialize.
Methods inherited from Base
#alternatives, #canonical_label=, #coerce, configure, #configure, #configure_as_canonical, construct, construct_and_load, #divide, #has_same_identity_as?, #has_scaling?, initialize_prefixed_version, #is_alternative_for?, #is_base_quantity_si_unit?, #is_base_unit?, #is_benchmark_unit?, #is_compound_unit?, #is_derived_unit?, #is_dimensionless?, #is_equivalent_to?, #is_non_si_unit?, #is_prefixed_unit?, #is_si_unit?, #load, load, #loaded?, #make_canonical, #measures, #multiply, #pluralized_name, #pow, prefix_and_load, #reciprocalize, #refresh_attributes, #scaling, #si_unit, #to_hash, #unload, #valid?, #valid_descriptors?, #valid_dimensions?, #with_prefix, #with_prefixes
Methods included from ExtendedMethods
Constructor Details
#initialize(options = nil) ⇒ NonSI
Additional initialize. Some NonSI units - temperature units, celsius and farenheit - contain scaling factors in addition to multiplicative factors. These are required in order to perform conversion, e.g. kelvin => celsius and therefore become and additional attribute to NonSI units
13 14 15 16 17 18 19 |
# File 'lib/quantify/unit/non_si_unit.rb', line 13 def initialize(=nil) @scaling = 0.0 if .is_a?(Hash) && [:scaling] @scaling = .delete(:scaling).to_f end super() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Quantify::Unit::Base