Sha256: ed72213645d1864766b44c872ff5a392119941f7a6b54ba6f2f1b5f5746547cd

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

module MiniCamel
  module ProcessorDefinition
    class Validate < Base

      values do
        attribute :field, Symbol
        validates :field, presence: true

        attribute :message, String
        validates :message, presence: true

        attribute :raise_error, Class
        validates :raise_error, presence: true
      end

      def generate_processor(env)
        Processor::Validate.new(env: env, field: field, message: message, raise_error: raise_error)
      end

      def message
        @message ||= "'#{field}' is invalid."
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mini_camel-0.5.8 lib/mini_camel/processor_definition/validate.rb