Class: Kharon::Processor

Inherits:
Object
  • Object
show all
Defined in:
lib/kharon/processor.rb

Overview

A basic processor used to be subclassed by all different processors. It provides basic informations to process a hash key validation.

Author:

Direct Known Subclasses

Kharon::Processors::ArrayProcessor, Kharon::Processors::BooleanProcessor, Kharon::Processors::BoxProcessor, Kharon::Processors::DateProcessor, Kharon::Processors::DatetimeProcessor, Kharon::Processors::EmailProcessor, Kharon::Processors::HashProcessor, Kharon::Processors::IntegerProcessor, Kharon::Processors::NumericProcessor, Kharon::Processors::SSIDProcessor, Kharon::Processors::TextProcessor

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Processor) initialize(validator)

Returns a new instance of Processor



11
12
13
# File 'lib/kharon/processor.rb', line 11

def initialize(validator)
  @validator = validator
end

Instance Attribute Details

- (Object) validator

Returns the value of attribute validator



9
10
11
# File 'lib/kharon/processor.rb', line 9

def validator
  @validator
end

Instance Method Details

- (Object) process(key, options = {})

Default processing method, simply storing the validated key in the filtered hash.

Parameters:

  • key (Object)

    the key associated with the value currently filteres in the filtered datas.

  • options (Hash) (defaults to: {})

    the options applied to the initial value.



18
19
20
# File 'lib/kharon/processor.rb', line 18

def process(key, options = {})
  store(key, ->(item){item}, options)
end