Class: Gitenv::Copy::Action

Inherits:
Action
  • Object
show all
Defined in:
lib/gitenv/actions/copy.rb

Instance Attribute Summary

Attributes inherited from Action

#options

Instance Method Summary collapse

Methods inherited from Action

#each, #each_file

Constructor Details

#initialize(context, files, options) ⇒ Action

Returns a new instance of Action.



7
8
9
# File 'lib/gitenv/actions/copy.rb', line 7

def initialize(context, files, options)
  super context, Copy, files, options
end

Instance Method Details

#onceObject



19
20
21
22
23
# File 'lib/gitenv/actions/copy.rb', line 19

def once
  @options[:overwrite] = false
  @options[:backup] = false
  self
end

#overwrite(*args) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/gitenv/actions/copy.rb', line 11

def overwrite *args
  options = args.last.is_a?(Hash) ? args.pop : {}
  overwrite = args.empty? ? true : args.shift
  @options[:overwrite] = overwrite
  @options[:backup] = options[:backup] if options.key?(:backup)
  self
end