Class: ContentBlockTools::TaxComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- ContentBlockTools::TaxComponent
- Defined in:
- app/components/content_block_tools/tax_component.rb
Constant Summary collapse
- SUPPORTED_FORMATS =
%w[ default tax_table ].freeze
Instance Method Summary collapse
-
#initialize(content_block:, _block_type: nil, _block_name: nil) ⇒ TaxComponent
constructor
A new instance of TaxComponent.
- #render ⇒ Object
Methods included from OverrideClasses
#font_classes, #font_size_class, #font_weight_class, #margin_classes, #padding_classes
Methods included from Govspeak
Constructor Details
#initialize(content_block:, _block_type: nil, _block_name: nil) ⇒ TaxComponent
Returns a new instance of TaxComponent.
8 9 10 11 12 |
# File 'app/components/content_block_tools/tax_component.rb', line 8 def initialize(content_block:, _block_type: nil, _block_name: nil) @content_block = content_block validate_format! validate_presence_of_income_tax_rates! if tax_table_format? end |
Instance Method Details
#render ⇒ Object
14 15 16 17 18 |
# File 'app/components/content_block_tools/tax_component.rb', line 14 def render return "" unless tax_table_format? Tax::TaxTableComponent.new(rates: income_tax_rates).render end |