class CloudwatchToGraphite::Validator

static methods to validate arguments

Public Class Methods

hash_with_key(h, key) click to toggle source
# File lib/cloudwatchtographite/validator.rb, line 32
def self.hash_with_key(h, key)
  raise ArgumentTypeError unless h.kind_of?(Hash) and h.has_key?(key)
end
hash_with_key_of_type(h, key, type) click to toggle source
# File lib/cloudwatchtographite/validator.rb, line 42
def self.hash_with_key_of_type(h, key, type)
  hash_with_key(h, key)
  raise ArgumentTypeError unless h[key].kind_of?(type)
end
hash_with_keys(h, keys) click to toggle source
# File lib/cloudwatchtographite/validator.rb, line 36
def self.hash_with_keys(h, keys)
  keys.each do |k|
    hash_with_key(h,k)
  end
end
string(n) click to toggle source
# File lib/cloudwatchtographite/validator.rb, line 18
def self.string(n)
  raise ArgumentTypeError unless n.kind_of?(String)
end
string_longer_than(n, length) click to toggle source
# File lib/cloudwatchtographite/validator.rb, line 27
def self.string_longer_than(n, length)
  string(n)
  raise ArgumentLengthError unless n.length > length
end
string_shorter_than(n, length) click to toggle source
# File lib/cloudwatchtographite/validator.rb, line 22
def self.string_shorter_than(n, length)
  string(n)
  raise ArgumentLengthError unless n.length < length
end