Class: Gitenv::Action

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

Direct Known Subclasses

Copy::Action, Symlink::Action

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, type, files, options) ⇒ Action

Returns a new instance of Action.



5
6
7
8
9
10
# File 'lib/gitenv/actions.rb', line 5

def initialize(context, type, files, options)
  @context = context
  @type = type
  @files = files
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/gitenv/actions.rb', line 3

def options
  @options
end

Instance Method Details

#each(&block) ⇒ Object



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

def each(&block)
  @files.files(@context.from).each do |f|
    block.call @type.new(@context, f, @options)
  end
end

#each_file(&block) ⇒ Object



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

def each_file(&block)
  @files.files(@context.from).each do |f|
    block.call File.join(@context.from, f)
  end
end