Sha256: c9eddf769957c964b3cb9e18e20a5bbacda6fa14c1ce596dec6c68a81c56ee9e

Contents?: true

Size: 438 Bytes

Versions: 33

Compression:

Stored size: 438 Bytes

Contents

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

    def invoke_actions(args)
      self.class.actions.each do |action|
        self.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

33 entries across 33 versions & 1 rubygems

Version Path
rake_factory-0.30.0.pre.5 lib/rake_factory/actions.rb
rake_factory-0.30.0.pre.4 lib/rake_factory/actions.rb
rake_factory-0.30.0.pre.3 lib/rake_factory/actions.rb
rake_factory-0.30.0.pre.2 lib/rake_factory/actions.rb
rake_factory-0.30.0.pre.1 lib/rake_factory/actions.rb
rake_factory-0.29.0 lib/rake_factory/actions.rb
rake_factory-0.28.0.pre.2 lib/rake_factory/actions.rb
rake_factory-0.28.0.pre.1 lib/rake_factory/actions.rb
rake_factory-0.27.0 lib/rake_factory/actions.rb
rake_factory-0.26.0.pre.1 lib/rake_factory/actions.rb
rake_factory-0.24.0.pre.2 lib/rake_factory/actions.rb
rake_factory-0.25.0 lib/rake_factory/actions.rb
rake_factory-0.24.0.pre.1 lib/rake_factory/actions.rb
rake_factory-0.23.0 lib/rake_factory/actions.rb
rake_factory-0.22.0.pre.1 lib/rake_factory/actions.rb
rake_factory-0.21.0 lib/rake_factory/actions.rb
rake_factory-0.20.0.pre.1 lib/rake_factory/actions.rb
rake_factory-0.19.0 lib/rake_factory/actions.rb
rake_factory-0.18.0.pre.2 lib/rake_factory/actions.rb
rake_factory-0.18.0.pre.1 lib/rake_factory/actions.rb