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