Class: Houston::Module

Inherits:
Object
  • Object
show all
Defined in:
lib/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(module_name, options = {}, &moduleconfig) ⇒ Module

Returns a new instance of Module.



454
455
456
457
458
459
460
461
462
# File 'lib/configuration.rb', line 454

def initialize(module_name, options={}, &moduleconfig)
  @name = module_name.to_s

  if namespace.respond_to?(:config) && block_given?
    namespace.config(&moduleconfig)
  elsif block_given? && !namespace.respond_to?(:config)
    raise "#{name} does not accept configuration"
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



452
453
454
# File 'lib/configuration.rb', line 452

def name
  @name
end

Instance Method Details

#engineObject



464
465
466
# File 'lib/configuration.rb', line 464

def engine
  namespace::Engine
end

#namespaceObject



472
473
474
# File 'lib/configuration.rb', line 472

def namespace
  @namespace ||= "houston/#{name}".camelize.constantize
end

#pathObject



468
469
470
# File 'lib/configuration.rb', line 468

def path
  "/#{name}"
end