Sha256: ce5d23ebc11783c7e622e045c2bcdf0202dc97470e68787fa56386593a460316

Contents?: true

Size: 464 Bytes

Versions: 13

Compression:

Stored size: 464 Bytes

Contents

# frozen_string_literal: true

module RakeFactory
  module Actions
    def self.included(base)
      base.extend(ClassMethods)
    end

    def invoke_actions(args)
      self.class.actions.each do |action|
        instance_exec(*[self, args].slice(0, action.arity), &action)
      end
    end

    module ClassMethods
      def actions
        @actions ||= []
      end

      def action(&action_block)
        actions << action_block
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rake_factory-0.34.0.pre.2 lib/rake_factory/actions.rb
rake_factory-0.34.0.pre.1 lib/rake_factory/actions.rb
rake_factory-0.33.0 lib/rake_factory/actions.rb
rake_factory-0.32.0.pre.6 lib/rake_factory/actions.rb
rake_factory-0.32.0.pre.5 lib/rake_factory/actions.rb
rake_factory-0.32.0.pre.4 lib/rake_factory/actions.rb
rake_factory-0.32.0.pre.3 lib/rake_factory/actions.rb
rake_factory-0.32.0.pre.2 lib/rake_factory/actions.rb
rake_factory-0.32.0.pre.1 lib/rake_factory/actions.rb
rake_factory-0.31.0 lib/rake_factory/actions.rb
rake_factory-0.30.0.pre.8 lib/rake_factory/actions.rb
rake_factory-0.30.0.pre.7 lib/rake_factory/actions.rb
rake_factory-0.30.0.pre.6 lib/rake_factory/actions.rb