Class: GovukPublishingComponents::Presenters::BigNumberHelper
- Inherits:
-
Object
- Object
- GovukPublishingComponents::Presenters::BigNumberHelper
- Defined in:
- lib/govuk_publishing_components/presenters/big_number_helper.rb
Instance Method Summary collapse
-
#initialize(local_assigns) ⇒ BigNumberHelper
constructor
A new instance of BigNumberHelper.
-
#number_has_plus_suffix? ⇒ Boolean
This function is to check for small symbols which alter how the number is rendered lightly We do this to account for small symbols awkwardly sitting above the baseline in our typeface and adjust them to sit at the baseline for the purpose of visual harmony Currently the only small symbol used with big numbers are pluses so they are specifically targetted in the below code.
- #value_classes ⇒ Object
Constructor Details
#initialize(local_assigns) ⇒ BigNumberHelper
Returns a new instance of BigNumberHelper.
4 5 6 7 8 |
# File 'lib/govuk_publishing_components/presenters/big_number_helper.rb', line 4 def initialize(local_assigns) @label = local_assigns[:label] @href = local_assigns[:href] @number = local_assigns[:number] || nil end |
Instance Method Details
#number_has_plus_suffix? ⇒ Boolean
This function is to check for small symbols which alter how the number is rendered lightly We do this to account for small symbols awkwardly sitting above the baseline in our typeface and adjust them to sit at the baseline for the purpose of visual harmony Currently the only small symbol used with big numbers are pluses so they are specifically targetted in the below code
23 24 25 26 27 |
# File 'lib/govuk_publishing_components/presenters/big_number_helper.rb', line 23 def number_has_plus_suffix? if @number.is_a? String @number.ends_with?("+") end end |
#value_classes ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/govuk_publishing_components/presenters/big_number_helper.rb', line 10 def value_classes class_list = ["gem-c-big-number__value"] if @label.nil? && @href class_list << "gem-c-big-number__value--decorated" end class_list end |