Method: Ward::Context#initialize

Defined in:
lib/ward/context.rb

#initialize(attribute, *context_args, &context_block) ⇒ Context

Creates a new validator instance.

Parameters:

  • attribute (#to_sym)

    The name of the attribute to be validated.

  • *context_args (*)

    Arguments to be used when calling the context.

  • context_block (Block)

    A block to be used when calling the context.



40
41
42
43
44
45
46
# File 'lib/ward/context.rb', line 40

def initialize(attribute, *context_args, &context_block)
  @attribute = attribute.to_sym
  @context_args, @context_block = context_args, context_block

  @natural_name =
    ActiveSupport::Inflector.humanize(@attribute.to_s).downcase
end