Module: SteelWheel::Components::ClassMethods

Defined in:
lib/steel_wheel/components.rb

Overview

rubocop:disable Style/Documentation

Instance Method Summary collapse

Instance Method Details

#form(klass = nil, &block) ⇒ Object



30
31
32
33
# File 'lib/steel_wheel/components.rb', line 30

def form(klass = nil, &block)
  self.form_definition = Class.new(klass) if klass
  form_definition.class_eval(&block) if block
end

#form_definitionObject



21
22
23
# File 'lib/steel_wheel/components.rb', line 21

def form_definition
  @form_definition ||= Class.new(ActionForm::Rails::Base)
end

#form_params_definitionObject



17
18
19
# File 'lib/steel_wheel/components.rb', line 17

def form_params_definition
  @form_params_definition ||= form_definition.params_definition
end

#url_params(klass = nil, &block) ⇒ Object



25
26
27
28
# File 'lib/steel_wheel/components.rb', line 25

def url_params(klass = nil, &block)
  self.url_params_definition = Class.new(klass) if klass
  url_params_definition.class_exec(self, &block) if block
end

#url_params_definitionObject



13
14
15
# File 'lib/steel_wheel/components.rb', line 13

def url_params_definition
  @url_params_definition ||= Class.new(SteelWheel::Params)
end