Sha256: bbb43c901b4c74d70167f22f2561cd36e4b5bbf72fb12b9d8b199cf72f4ea968

Contents?: true

Size: 711 Bytes

Versions: 2

Compression:

Stored size: 711 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

2 entries across 2 versions & 1 rubygems

Version Path
gitenv-0.2.0 lib/gitenv/actions.rb
gitenv-0.1.0 lib/gitenv/actions.rb