class Validator::MongoAttribValidator

MongoDB collection attributes and properties validator

Public Class Methods

new(coll_name, db, field) click to toggle source
Calls superclass method Connector::MongoConnector::new
# File lib/mylookup/validator.rb, line 38
def initialize(coll_name, db, field)
    super(coll_name, db_name: db)
    @field = field
end

Public Instance Methods

validate_field() click to toggle source
# File lib/mylookup/validator.rb, line 43
def validate_field
    if field_exists? @field
        [true, "'#{@field}' field exists in '#{@coll_name}' collection"]
    else
        [false, "'#{@field}' field DOES NOT exist in '#{@coll_name}' collection"]
    end
end