Sha256: 34e5a35e56674f8348592e8caea973c13ed43f4ef77bead9e7b4b67bf9ca3f1a

Contents?: true

Size: 707 Bytes

Versions: 4

Compression:

Stored size: 707 Bytes

Contents

module Gitenv

  class Action
    attr_reader :options

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

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

    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|
      define_method m do |*args|
        @context.send *(args.unshift m)
        self
      end
    end
  end
end

Dir[File.join File.dirname(__FILE__), File.basename(__FILE__, '.*'), '*.rb'].each{ |lib| require lib }

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gitenv-1.1.0 lib/gitenv/actions.rb
gitenv-1.0.4 lib/gitenv/actions.rb
gitenv-1.0.0 lib/gitenv/actions.rb
gitenv-0.3.0 lib/gitenv/actions.rb