Sha256: 485292cf5bfa87ab4095b045b02a3eda0648a407c858762ea1b16d1c3bfcb478
Contents?: true
Size: 884 Bytes
Versions: 22
Compression:
Stored size: 884 Bytes
Contents
module Picky # coding: utf-8 # module Query # Collection class for qualifiers. # class QualifierCategoryMapper # :nodoc:all attr_reader :mapping # # def initialize @mapping = {} end # # def add category category.qualifiers.each do |qualifier| sym_qualifier = qualifier.to_sym warn %Q{Warning: Qualifier "#{qualifier}" already mapped to category #{mapping[sym_qualifier].identifier} (ambiguous qualifier mapping).} if mapping.has_key? sym_qualifier mapping[sym_qualifier] = category end end # Normalizes the given qualifier. # # Returns nil if it is not allowed, the normalized qualifier if it is. # def map qualifier return nil if qualifier.blank? @mapping[qualifier.to_sym] end end end end
Version data entries
22 entries across 22 versions & 1 rubygems