Class: ViewComponentReducible::State::DSL::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/view_component_reducible/state/dsl.rb

Instance Method Summary collapse

Constructor Details

#initialize(schema) ⇒ Builder

Returns a new instance of Builder.



29
# File 'lib/view_component_reducible/state/dsl.rb', line 29

def initialize(schema) = (@schema = schema)

Instance Method Details

#field(name, default:) ⇒ void

This method returns an undefined value.

Define a state field.

Parameters:

  • name (Symbol)
  • default (Object, #call)


35
36
37
# File 'lib/view_component_reducible/state/dsl.rb', line 35

def field(name, default:)
  @schema.add_field(name, default:)
end