class Locca::ConfigValidator

Attributes

fields[RW]

Public Class Methods

new(fields = nil) click to toggle source
# File lib/locca/config_validator.rb, line 29
def initialize(fields = nil)
    @fields = fields
end

Public Instance Methods

validate(hash) click to toggle source
# File lib/locca/config_validator.rb, line 33
def validate(hash)
    if not @fields 
        return true
    end

    @fields.each do |field|
        if not hash.has_key?(field)
            return false
        end
    end

    return true
end