Class: Strings::Numeral::Configuration

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

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize a configuration

API:

  • private



9
10
11
12
13
14
15
# File 'lib/strings/numeral/configuration.rb', line 9

def initialize
  @currency = :usd
  @delimiter = ", "
  @decimal = :fraction
  @separator = nil
  @trailing_zeros = false
end

Instance Method Details

#currency(value = (not_set = true)) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/strings/numeral/configuration.rb', line 17

def currency(value = (not_set = true))
  if not_set
    @currency
  else
    @currency = value
  end
end

#decimal(value = (not_set = true)) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/strings/numeral/configuration.rb', line 41

def decimal(value = (not_set = true))
  if not_set
    @decimal
  else
    @decimal = value
  end
end

#delimiter(value = (not_set = true)) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/strings/numeral/configuration.rb', line 25

def delimiter(value = (not_set = true))
  if not_set
    @delimiter
  else
    @delimiter = value
  end
end

#separator(value = (not_set = true)) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/strings/numeral/configuration.rb', line 33

def separator(value = (not_set = true))
  if not_set
    @separator
  else
    @separator = value
  end
end

#trailing_zeros(value = (not_set = true)) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/strings/numeral/configuration.rb', line 49

def trailing_zeros(value = (not_set = true))
  if not_set
    @trailing_zeros
  else
    @trailing_zeros = value
  end
end