Class: Capistrano::Configuration::Server::Selector

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

Direct Known Subclasses

Exclusive

Defined Under Namespace

Classes: Exclusive

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Selector

Returns a new instance of Selector.



119
120
121
# File 'lib/capistrano/configuration/server.rb', line 119

def initialize(options)
  @options = options
end

Class Method Details

.for(options) ⇒ Object



123
124
125
126
127
128
129
# File 'lib/capistrano/configuration/server.rb', line 123

def self.for(options)
  if options.has_key?(:exclude)
    Exclusive
  else
    self
  end.new(options)
end

Instance Method Details

#call(server) ⇒ Object



139
140
141
# File 'lib/capistrano/configuration/server.rb', line 139

def call(server)
  callable.call(server)
end

#callableObject



131
132
133
134
135
136
137
# File 'lib/capistrano/configuration/server.rb', line 131

def callable
  if key.respond_to?(:call)
    key
  else
    ->(server) { server.fetch(key) }
  end
end