Class: Capistrano::Configuration::Namespaces::Namespace

Inherits:
Object
  • Object
show all
Includes:
AliasTask, Capistrano::Configuration::Namespaces
Defined in:
lib/capistrano/configuration/namespaces.rb

Constant Summary

Constants included from Capistrano::Configuration::Namespaces

DEFAULT_TASK

Instance Attribute Summary

Attributes included from Capistrano::Configuration::Namespaces

#name, #namespaces, #parent, #tasks

Instance Method Summary collapse

Methods included from Capistrano::Configuration::Namespaces

#default_task, #define_task, #desc, #find_task, #fully_qualified_name, included, #namespace, #next_description, #search_task, #task, #task_list, #top

Methods included from AliasTask

#alias_task

Constructor Details

#initialize(name, parent) ⇒ Namespace

Returns a new instance of Namespace.



176
177
178
179
# File 'lib/capistrano/configuration/namespaces.rb', line 176

def initialize(name, parent)
  @parent = parent
  @name = name
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



189
190
191
192
193
194
195
# File 'lib/capistrano/configuration/namespaces.rb', line 189

def method_missing(sym, *args, &block)
  if parent.respond_to?(sym)
    parent.send(sym, *args, &block)
  else
    super
  end
end

Instance Method Details

#respond_to?(sym, include_priv = false) ⇒ Boolean

Returns:

  • (Boolean)


185
186
187
# File 'lib/capistrano/configuration/namespaces.rb', line 185

def respond_to?(sym, include_priv=false)
  super || parent.respond_to?(sym, include_priv)
end

#role(*args) ⇒ Object

Raises:

  • (NotImplementedError)


181
182
183
# File 'lib/capistrano/configuration/namespaces.rb', line 181

def role(*args)
  raise NotImplementedError, "roles cannot be defined in a namespace"
end