Sha256: fe56500f3eca814ba1ae6997c66997a66c0069e3084c01e280d61950c391a6ee

Contents?: true

Size: 734 Bytes

Versions: 1

Compression:

Stored size: 734 Bytes

Contents

# Comfortable API convenience class, splits methods to indexes.
#
class Types
  
  attr_reader :types, :type_mapping
  
  delegate :reload,
           :load_from_cache,
           :to => :@indexes
  
  delegate :index,
           :generate_index_only,
           :generate_cache_only,
           :to => :@indexings
  
  def initialize
    @types = []
    @type_mapping = {}
    
    @indexes   = Index::Types.new
    @indexings = Indexing::Types.new
  end
  
  def register type
    self.types << type
    self.type_mapping[type.name] = type
    
    @indexings.register type.indexing
    @indexes.register   type.index # TODO Even necessary?
  end
  
  def [] name
    name = name.to_sym
    
    self.type_mapping[name]
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
picky-0.11.0 lib/picky/types.rb