class Capistrano::Env::Config
Attributes
envs[R]
filemode[RW]
filename[RW]
Public Class Methods
new() { |self| ... }
click to toggle source
# File lib/capistrano/env/config.rb, line 10 def initialize @envs = {} @filemode = '0640' @filename = '.env' yield(self) if block_given? end
Public Instance Methods
add(name_or_regexp, val = nil, &block)
click to toggle source
# File lib/capistrano/env/config.rb, line 21 def add(name_or_regexp, val = nil, &block) if val && name_or_regexp.is_a?(String) set_env(name_or_regexp, val) else find_envs(name_or_regexp).each do |key, value| set_env(key, value, &block) end end end
inspect()
click to toggle source
# File lib/capistrano/env/config.rb, line 17 def inspect envs end
Private Instance Methods
find_envs(key)
click to toggle source
# File lib/capistrano/env/config.rb, line 38 def find_envs(key) case key when Regexp ENV.select { |x| x =~ key } else ENV.select { |x| x == key } end end
set_env(key, value) { |key| ... }
click to toggle source
# File lib/capistrano/env/config.rb, line 33 def set_env(key, value) key = yield(key) if block_given? @envs[key] = value end