Module: Tire::Namespace::Index

Defined in:
lib/tire/namespace/index.rb

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/tire/namespace/index.rb', line 4

def self.included klass
  klass.class_eval do

    # Redefine the `initialize` method to prefix the index name with the namespace
    #
    def initialize(name, &block)
      @name = Tire::Configuration.namespace ? "#{Tire::Configuration.namespace}-#{name}" : name
      block.arity < 1 ? instance_eval(&block) : block.call(self) if block_given?
    end

  end
end