Class: TwitterCldr::Formatters::Rbnf::Substitution

Inherits:
Struct
  • Object
show all
Defined in:
lib/twitter_cldr/formatters/numbers/rbnf/substitution.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contentsObject

Returns the value of attribute contents

Returns:

  • (Object)

    the current value of contents



10
11
12
# File 'lib/twitter_cldr/formatters/numbers/rbnf/substitution.rb', line 10

def contents
  @contents
end

#lengthObject

Returns the value of attribute length

Returns:

  • (Object)

    the current value of length



10
11
12
# File 'lib/twitter_cldr/formatters/numbers/rbnf/substitution.rb', line 10

def length
  @length
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



10
11
12
# File 'lib/twitter_cldr/formatters/numbers/rbnf/substitution.rb', line 10

def type
  @type
end

Instance Method Details

#decimal_formatObject



21
22
23
24
25
# File 'lib/twitter_cldr/formatters/numbers/rbnf/substitution.rb', line 21

def decimal_format
  if item = contents.first
    item.value if item.type == :decimal
  end
end

#descriptionObject



11
12
13
# File 'lib/twitter_cldr/formatters/numbers/rbnf/substitution.rb', line 11

def description
  @description ||= contents.map(&:value).join
end

#rule_set_referenceObject



15
16
17
18
19
# File 'lib/twitter_cldr/formatters/numbers/rbnf/substitution.rb', line 15

def rule_set_reference
  if item = contents.first
    item.value.gsub("%", "") if item.type == :rule
  end
end