Class: Natsukantou::Setup::Registry

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/natsukantou/setup/registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRegistry

Returns a new instance of Registry.



13
14
15
16
# File 'lib/natsukantou/setup/registry.rb', line 13

def initialize
  @translators = []
  @middlewares = []
end

Instance Attribute Details

#middlewaresObject (readonly)

Returns the value of attribute middlewares.



11
12
13
# File 'lib/natsukantou/setup/registry.rb', line 11

def middlewares
  @middlewares
end

#translatorsObject (readonly)

Returns the value of attribute translators.



10
11
12
# File 'lib/natsukantou/setup/registry.rb', line 10

def translators
  @translators
end

Instance Method Details

#register(type, klass, path) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/natsukantou/setup/registry.rb', line 18

def register(type, klass, path)
  case type
  when :translator
    translators << [klass, path]
  when :middleware
    middlewares << [klass, path]
  end
end