Class: RubyUnits::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_units/configuration.rb

Overview

holds actual configuration values for RubyUnits

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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

#formatObject

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

#separatorObject

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