Class: GOVUKDesignSystemFormBuilder::Containers::CharacterCount
- Defined in:
- lib/govuk_design_system_formbuilder/containers/character_count.rb
Instance Method Summary collapse
- #html(&block) ⇒ Object
-
#initialize(builder, max_words:, max_chars:, threshold:) ⇒ CharacterCount
constructor
A new instance of CharacterCount.
Methods inherited from Base
Constructor Details
#initialize(builder, max_words:, max_chars:, threshold:) ⇒ CharacterCount
Returns a new instance of CharacterCount.
4 5 6 7 8 9 10 11 12 |
# File 'lib/govuk_design_system_formbuilder/containers/character_count.rb', line 4 def initialize(builder, max_words:, max_chars:, threshold:) super(builder, nil, nil) fail ArgumentError, 'limit can be words or chars' if max_words && max_chars @max_words = max_words @max_chars = max_chars @threshold = threshold end |
Instance Method Details
#html(&block) ⇒ Object
14 15 16 17 18 |
# File 'lib/govuk_design_system_formbuilder/containers/character_count.rb', line 14 def html(&block) return yield unless limit? tag.div(**, &block) end |