class Capistrano::Configuration::Server::Properties

Public Class Methods

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

Public Instance Methods

fetch(key) click to toggle source
# File lib/capistrano/configuration/server.rb, line 99
def fetch(key)
  @properties[key]
end
keys() click to toggle source
# File lib/capistrano/configuration/server.rb, line 111
def keys
  @properties.keys
end
method_missing(key, value=nil) click to toggle source

rubocop:disable Style/MethodMissing

# File lib/capistrano/configuration/server.rb, line 116
def method_missing(key, value=nil)
  if value
    set(lvalue(key), value)
  else
    fetch(key)
  end
end
respond_to_missing?(method, _include_all=false) click to toggle source
Calls superclass method
# File lib/capistrano/configuration/server.rb, line 103
def respond_to_missing?(method, _include_all=false)
  @properties.key?(method) || super
end
roles() click to toggle source
# File lib/capistrano/configuration/server.rb, line 107
def roles
  @roles ||= Set.new
end
set(key, value) click to toggle source
# File lib/capistrano/configuration/server.rb, line 86
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
to_h() click to toggle source

rubocop:enable Style/MethodMissing

# File lib/capistrano/configuration/server.rb, line 125
def to_h
  @properties
end

Private Instance Methods

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