class Capistrano::Configuration::Server::Properties

Public Class Methods

new() click to toggle source
# File lib/capistrano/configuration/server.rb, line 81
def initialize
  @properties = {}
end

Public Instance Methods

fetch(key) click to toggle source
# File lib/capistrano/configuration/server.rb, line 98
def fetch(key)
  @properties[key]
end
keys() click to toggle source
# File lib/capistrano/configuration/server.rb, line 110
def keys
  @properties.keys
end
method_missing(key, value=nil) click to toggle source
# File lib/capistrano/configuration/server.rb, line 114
def method_missing(key, value=nil)
  if value
    set(lvalue(key), value)
  else
    fetch(key)
  end
end
respond_to?(method, _include_all=false) click to toggle source
# File lib/capistrano/configuration/server.rb, line 102
def respond_to?(method, _include_all=false)
  @properties.key?(method)
end
roles() click to toggle source
# File lib/capistrano/configuration/server.rb, line 106
def roles
  @roles ||= Set.new
end
set(key, value) click to toggle source
# File lib/capistrano/configuration/server.rb, line 85
def set(key, value)
  pval = @properties[key]
  if pval.is_a?(Hash) && value.is_a?(Hash)
    pval.merge!(value)
  elsif pval.is_a?(Set) && value.is_a?(Set)
    pval.merge(value)
  elsif pval.is_a?(Array) && value.is_a?(Array)
    pval.concat value
  else
    @properties[key] = value
  end
end

Private Instance Methods

lvalue(key) click to toggle source
# File lib/capistrano/configuration/server.rb, line 124
def lvalue(key)
  key.to_s.chomp("=").to_sym
end