Sha256: e24d5dbed7ba07450570838483d502fda57c14128328a6d55c751ad344461483

Contents?: true

Size: 493 Bytes

Versions: 4

Compression:

Stored size: 493 Bytes

Contents

module TableCloth
  class Actions
    attr_reader :column, :options

    def initialize(options={}, &block)
      @options = options
      @column = Columns::Action.new(:actions, options)

      block.arity > 0 ? block.call(self) : instance_eval(&block)
    end

    def action(*args, &block)
      options        = args.extract_options! || {}
      options[:proc] = block if block_given?

      column.actions << Action.new(options)
    end

    def all
      column.actions
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
table_cloth-0.2.3 lib/table_cloth/actions.rb
table_cloth-0.2.2 lib/table_cloth/actions.rb
table_cloth-0.2.1 lib/table_cloth/actions.rb
table_cloth-0.2.0 lib/table_cloth/actions.rb