Class: RubyUnits::Configuration
- Inherits:
-
Object
- Object
- RubyUnits::Configuration
- Defined in:
- lib/ruby_units/configuration.rb
Overview
holds actual configuration values for RubyUnits
Instance Attribute Summary collapse
-
#format ⇒ Object
The style of format to use by default when generating output.
-
#separator ⇒ Object
Used to separate the scalar from the unit when generating output.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
45 46 47 48 |
# File 'lib/ruby_units/configuration.rb', line 45 def initialize self.format = :rational self.separator = true end |
Instance Attribute Details
#format ⇒ Object
The style of format to use by default when generating output. When set to ‘:exponential`, all units will be represented in exponential notation instead of using a numerator and denominator.
43 44 45 |
# File 'lib/ruby_units/configuration.rb', line 43 def format @format end |
#separator ⇒ Object
Used to separate the scalar from the unit when generating output. A value of ‘true` will insert a single space, and `false` will prevent adding a space to the string representation of a unit.
36 37 38 |
# File 'lib/ruby_units/configuration.rb', line 36 def separator @separator end |