Class: Fluent::Counter::ArrayValidator

Inherits:
Validator
  • Object
show all
Defined in:
lib/fluent/counter/validator.rb

Constant Summary

Constants inherited from Validator

Validator::VALID_METHODS, Validator::VALID_NAME, Validator::VALID_SCOPE_NAME

Instance Method Summary collapse

Methods inherited from Validator

#call, #initialize, request

Constructor Details

This class inherits a constructor from Fluent::Counter::Validator

Instance Method Details

#validate_key!(name) ⇒ Object



80
81
82
83
84
85
86
87
88
# File 'lib/fluent/counter/validator.rb', line 80

def validate_key!(name)
  unless name.is_a?(String)
    raise Fluent::Counter::InvalidParams.new('The type of `key` should be String')
  end

  unless VALID_NAME =~ name
    raise Fluent::Counter::InvalidParams.new('`key` is the invalid format')
  end
end

#validate_scope!(name) ⇒ Object



90
91
92
93
94
95
96
97
98
# File 'lib/fluent/counter/validator.rb', line 90

def validate_scope!(name)
  unless name.is_a?(String)
    raise Fluent::Counter::InvalidParams.new('The type of `scope` should be String')
  end

  unless VALID_SCOPE_NAME =~ name
    raise Fluent::Counter::InvalidParams.new('`scope` is the invalid format')
  end
end