Class: Primrose::Components::HiddenField

Inherits:
Rose
  • Object
show all
Defined in:
lib/primrose/components/hidden_field.rb

Constant Summary collapse

TEMPLATE =
<<~ERB
  <input type="hidden" name="<%= @name %>" value="<%= @value %>">
ERB

Instance Attribute Summary collapse

Attributes inherited from Rose

#children, #event_handlers, #state

Instance Method Summary collapse

Methods inherited from Rose

#add_child, #get_binding, #handle_error, #lifecycle, #on, #render_children, #trigger

Constructor Details

#initialize(name:, value:) ⇒ HiddenField

Returns a new instance of HiddenField.



10
11
12
13
# File 'lib/primrose/components/hidden_field.rb', line 10

def initialize(name:, value:)
  @name = name
  @value = value
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/primrose/components/hidden_field.rb', line 8

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



8
9
10
# File 'lib/primrose/components/hidden_field.rb', line 8

def value
  @value
end

Instance Method Details

#renderObject



15
16
17
# File 'lib/primrose/components/hidden_field.rb', line 15

def render
  Prim.render(TEMPLATE, self)
end