lib/gitenv/actions.rb in gitenv-1.1.0 vs lib/gitenv/actions.rb in gitenv-1.2.0
- old
+ new
@@ -1,32 +1,33 @@
-
module Gitenv
-
class Action
attr_reader :options
- def initialize context, type, files, options
- @context, @type, @files, @options = context, type, files, options
+ def initialize(context, type, files, options)
+ @context = context
+ @type = type
+ @files = files
+ @options = options
end
- def each &block
+ def each(&block)
@files.files(@context.from).each do |f|
block.call @type.new(@context, f, @options)
end
end
- def each_file &block
+ def each_file(&block)
@files.files(@context.from).each do |f|
block.call File.join(@context.from, f)
end
end
- %w(from to).each do |m|
+ %w[from to].each do |m|
define_method m do |*args|
- @context.send *(args.unshift m)
+ @context.send(*(args.unshift m))
self
end
end
end
end
-Dir[File.join File.dirname(__FILE__), File.basename(__FILE__, '.*'), '*.rb'].each{ |lib| require lib }
+Dir[File.join File.dirname(__FILE__), File.basename(__FILE__, '.*'), '*.rb'].each { |lib| require lib }