Class: Yattho::FormComponents
- Inherits:
-
Object
- Object
- Yattho::FormComponents
- Defined in:
- lib/yattho/form_components.rb
Overview
:nocov: :nodoc:
Class Method Summary collapse
Class Method Details
.from_input(input_klass) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/yattho/form_components.rb', line 7 def self.from_input(input_klass) Class.new(Yattho::Component) do @input_klass = input_klass class << self attr_reader :input_klass end def initialize(**system_arguments, &block) @system_arguments = system_arguments @block = block end def call builder = Yattho::Forms::Builder.new( nil, nil, __vc_original_view_context, {} ) input = self.class.input_klass.new( builder: builder, form: nil, **@system_arguments, &@block ) input.to_component.render_in(__vc_original_view_context) { content } end end end |