class Gitenv::Context
Attributes
ignores[RW]
Public Class Methods
new(config, options = {})
click to toggle source
# File lib/gitenv/context.rb, line 7 def initialize(config, options = {}) @config = config @from = options[:from] @to ||= File.expand_path('~') @ignores = options[:ignores] || [] @ignores << '.DS_Store' if @ignores.empty? and RbConfig::CONFIG['host_os'] =~ /darwin/ end
Public Instance Methods
dup()
click to toggle source
# File lib/gitenv/context.rb, line 45 def dup Context.new @config, from: @from, to: @to, ignores: @ignores.dup end
from(path = nil, &block)
click to toggle source
# File lib/gitenv/context.rb, line 17 def from(path = nil, &block) return @from if path.nil? old = @from @from = @from ? File.expand_path(path, @from) : File.expand_path(path) if block @config.instance_eval(&block) @from = old end self end
to(path = nil, &block)
click to toggle source
# File lib/gitenv/context.rb, line 31 def to(path = nil, &block) return @to if path.nil? old = @to @to = @to ? File.expand_path(path, @to) : File.expand_path(path) if block @config.instance_eval(&block) @to = old end self end