Sha256: 7ad6af5aea2c00c1638d97068e16a12016d4e2c72d297b09082af402ee05f9bf

Contents?: true

Size: 693 Bytes

Versions: 15

Compression:

Stored size: 693 Bytes

Contents

module Puffer
  module Controller
    class Actions < Array

      %w(match get post put delete).each do |method|
        define_method method do |*args|
          push Action.new(args.unshift(method))
        end
      end

    end

    class Action < Array

      def initialize *args
        super *args
        options = extract_options!
        @display = options.key?(:display) ? options.delete(:display) : true
        @label = options.delete(:label)
        push options
      end

      def method
        first
      end

      def action
        second
      end

      def label
        @label || second
      end

      def display?
        @display
      end

    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
puffer-0.0.25 lib/puffer/controller/actions.rb
puffer-0.0.24 lib/puffer/controller/actions.rb
puffer-0.0.23 lib/puffer/controller/actions.rb
puffer-0.0.22 lib/puffer/controller/actions.rb
puffer-0.0.21 lib/puffer/controller/actions.rb
puffer-0.0.20 lib/puffer/controller/actions.rb
puffer-0.0.19 lib/puffer/controller/actions.rb
puffer-0.0.18 lib/puffer/controller/actions.rb
puffer-0.0.17 lib/puffer/controller/actions.rb
puffer-0.0.16 lib/puffer/controller/actions.rb
puffer-0.0.15 lib/puffer/controller/actions.rb
puffer-0.0.14 lib/puffer/controller/actions.rb
puffer-0.0.13 lib/puffer/controller/actions.rb
puffer-0.0.12 lib/puffer/controller/actions.rb
puffer-0.0.11 lib/puffer/controller/actions.rb