Class: SourceMonitor::Configuration::ValidationDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/source_monitor/configuration/validation_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handler, options) ⇒ ValidationDefinition

Returns a new instance of ValidationDefinition.



8
9
10
11
# File 'lib/source_monitor/configuration/validation_definition.rb', line 8

def initialize(handler, options)
  @handler = handler
  @options = options
end

Instance Attribute Details

#handlerObject (readonly)

Returns the value of attribute handler.



6
7
8
# File 'lib/source_monitor/configuration/validation_definition.rb', line 6

def handler
  @handler
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/source_monitor/configuration/validation_definition.rb', line 6

def options
  @options
end

Instance Method Details

#signatureObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/source_monitor/configuration/validation_definition.rb', line 13

def signature
  handler_key =
    case handler
    when Symbol
      [ :symbol, handler ]
    when String
      [ :symbol, handler.to_sym ]
    else
      [ :callable, handler.object_id ]
    end

  [ handler_key, options ]
end

#symbol?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/source_monitor/configuration/validation_definition.rb', line 27

def symbol?
  handler.is_a?(Symbol) || handler.is_a?(String)
end