Class: Brut::FrontEnd::Forms::Button

Inherits:
Input
  • Object
show all
Defined in:
lib/brut/front_end/forms/button.rb

Overview

Represents the current state of a particular button that is part of a form. Button's in this context don't really have state, but this allows the button to be modeled like any other form element.

Instance Attribute Summary

Attributes inherited from Input

#typed_value, #validity_state, #value

Instance Method Summary collapse

Methods inherited from Input

#array?, #max, #maxlength, #min, #minlength, #name, #pattern, #required, #server_side_constraint_violation, #step, #type, #valid?

Constructor Details

#initialize(input_definition:, value:, index:) ⇒ Button

Create the input with the given definition and value

Parameters:



10
11
12
13
14
15
# File 'lib/brut/front_end/forms/button.rb', line 10

def initialize(input_definition:, value:, index:)
  @input_definition = input_definition
  @validity_state = Brut::FrontEnd::Forms::ValidityState.new
  @index = index
  self.value=(value)
end

Instance Method Details

#value=(new_value) ⇒ Object



17
18
19
20
# File 'lib/brut/front_end/forms/button.rb', line 17

def value=(new_value)
  @value = new_value.to_s
  @typed_value = @value
end