Class: TorqueBox::Configuration::Validator Private

Inherits:
Object
  • Object
show all
Defined in:
lib/torquebox/configuration/validator.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Method Summary collapse

Constructor Details

#initialize(ruleset, entry, options_to_validate) ⇒ Validator

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Validator.

API:

  • private



25
26
27
28
29
30
31
# File 'lib/torquebox/configuration/validator.rb', line 25

def initialize(ruleset, entry, options_to_validate)
  @required = ruleset[:required] || []
  @allowed = @required + (ruleset[:optional] || [])
  @entry = entry
  @options_to_validate = options_to_validate
  validate
end

Instance Method Details

#messageObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/torquebox/configuration/validator.rb', line 38

def message
  case messages.size
  when 0
    nil
  when 1
    messages.first
  else
    result = "There are multiple messages for this entry:"
    messages.each { |message| result << "\n  " << message }
    result
  end
end

#valid?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

API:

  • private



34
35
36
# File 'lib/torquebox/configuration/validator.rb', line 34

def valid?
  !message
end