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.



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

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

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#each(&block) ⇒ Object



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

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

#each_file(&block) ⇒ Object



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

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