Class: Osheet::Format::Numeric

Inherits:
Object
  • Object
show all
Includes:
Enumeration
Defined in:
lib/osheet/format/numeric.rb

Direct Known Subclasses

Currency, Number, Percentage, Scientific

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Numeric

Returns a new instance of Numeric.



14
15
16
17
18
19
# File 'lib/osheet/format/numeric.rb', line 14

def initialize(opts={})
  self.symbol = opts[:symbol] || :none
  self.decimal_places = opts[:decimal_places] || 0
  self.comma_separator = opts.has_key?(:comma_separator) ? opts[:comma_separator] : false
  self.negative_numbers = opts[:negative_numbers] || :black
end

Instance Attribute Details

#comma_separatorObject

Returns the value of attribute comma_separator.



10
11
12
# File 'lib/osheet/format/numeric.rb', line 10

def comma_separator
  @comma_separator
end

#decimal_placesObject

Returns the value of attribute decimal_places.



10
11
12
# File 'lib/osheet/format/numeric.rb', line 10

def decimal_places
  @decimal_places
end

Instance Method Details

#keyObject



36
37
38
# File 'lib/osheet/format/numeric.rb', line 36

def key
  "#{key_prefix}_#{symbol_key}_#{decimal_places_key}_#{comma_separator_key}_#{negative_numbers_key}"
end

#styleObject



32
33
34
# File 'lib/osheet/format/numeric.rb', line 32

def style
  negative_numbers_style
end