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

Inherits:
Object
  • Object
show all
Includes:
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, #desc, #find_task, #fully_qualified_name, included, #namespace, #next_description, #search_task, #task, #task_list, #top

Constructor Details

#initialize(name, parent) ⇒ Namespace

Returns a new instance of Namespace.


171
172
173
174
# File 'lib/capistrano/configuration/namespaces.rb', line 171

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


184
185
186
187
188
189
190
# File 'lib/capistrano/configuration/namespaces.rb', line 184

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)

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

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

#role(*args) ⇒ Object

Raises:

  • (NotImplementedError)

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

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