Skip to content

Commit

Permalink
Always call super on initialize
Browse files Browse the repository at this point in the history
  • Loading branch information
peteryates committed Jan 13, 2021
1 parent 055bb94 commit 315e31c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
Expand Up @@ -2,7 +2,7 @@ module GOVUKDesignSystemFormBuilder
module Containers
class CharacterCount < Base
def initialize(builder, max_words:, max_chars:, threshold:)
@builder = builder
super(builder, nil, nil)

fail ArgumentError, 'limit can be words or chars' if max_words && max_chars

Expand Down
Expand Up @@ -2,7 +2,8 @@ module GOVUKDesignSystemFormBuilder
module Containers
class CheckBoxes < Base
def initialize(builder, small:, classes: nil)
@builder = builder
super(builder, nil, nil)

@small = small
@classes = classes
end
Expand Down
3 changes: 2 additions & 1 deletion lib/govuk_design_system_formbuilder/containers/radios.rb
Expand Up @@ -4,7 +4,8 @@ class Radios < Base
include Traits::Hint

def initialize(builder, inline:, small:, classes:)
@builder = builder
super(builder, nil, nil)

@inline = inline
@small = small
@classes = classes
Expand Down
4 changes: 2 additions & 2 deletions lib/govuk_design_system_formbuilder/elements/error_summary.rb
Expand Up @@ -4,8 +4,8 @@ class ErrorSummary < Base
include Traits::Error

def initialize(builder, object_name, title, link_base_errors_to:)
@builder = builder
@object_name = object_name
super(builder, object_name, nil)

@title = title
@link_base_errors_to = link_base_errors_to
end
Expand Down
4 changes: 3 additions & 1 deletion lib/govuk_design_system_formbuilder/elements/null.rb
@@ -1,7 +1,9 @@
module GOVUKDesignSystemFormBuilder
module Elements
class Null < Base
def initialize; end
def initialize
super(nil, nil, nil)
end

def html
nil
Expand Down
3 changes: 2 additions & 1 deletion lib/govuk_design_system_formbuilder/elements/submit.rb
Expand Up @@ -4,9 +4,10 @@ class Submit < Base
using PrefixableArray

def initialize(builder, text, warning:, secondary:, classes:, prevent_double_click:, validate:, disabled:, &block)
super(builder, nil, nil)

fail ArgumentError, 'buttons can be warning or secondary' if warning && secondary

@builder = builder
@text = text
@prevent_double_click = prevent_double_click
@warning = warning
Expand Down

0 comments on commit 315e31c

Please sign in to comment.