Module: ViewComponentReducible::State::DSL::ClassMethods

Defined in:
lib/view_component_reducible/state/dsl.rb

Instance Method Summary collapse

Instance Method Details

#state { ... } ⇒ void

This method returns an undefined value.

Define a state schema for the component.

Yields:

  • DSL block to declare fields.



18
19
20
21
22
23
24
25
# File 'lib/view_component_reducible/state/dsl.rb', line 18

def state(&block)
  schema = Schema.new
  dsl = Builder.new(schema)
  dsl.instance_eval(&block)
  @vcr_state_schema = schema

  define_singleton_method(:vcr_state_schema) { @vcr_state_schema }
end