Module: ViewComponent::Form::ValidationContext

Included in:
Builder
Defined in:
lib/view_component/form/validation_context.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#validation_contextObject (readonly)

Returns the value of attribute validation_context.



6
7
8
# File 'lib/view_component/form/validation_context.rb', line 6

def validation_context
  @validation_context
end

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/view_component/form/validation_context.rb', line 8

def self.included(base)
  base.class_eval do
    original_initialize_method = instance_method(:initialize)

    define_method(:initialize) do |*args, &block|
      original_initialize_method.bind_call(self, *args, &block)

      @validation_context = options[:validation_context]
    end
  end
end