Sha256: b73422bec1671f3a2d4b301a7942700de3a5d9563a7c903ed60c103ae4119eea

Contents?: true

Size: 781 Bytes

Versions: 2

Compression:

Stored size: 781 Bytes

Contents

module TableGo
  class Column
    attr_accessor :table, :name, :options, :block

    def initialize(table, name, options = {}, &block)
      @table, @name, @options, @block = table, name, options, block
    end

    def label
      options[:label]
    end

    def as
      options[:as]
    end

    def send
      options[:send]
    end

    def as_options
      options[:as_options] || {}
    end

    def header_html
      options[:header_html]
    end

    def column_html
      options[:column_html]
    end

    def method
      options[:method]
    end

    def human_attribute_name
      if table.model_klass.respond_to?(:human_attribute_name)
        table.model_klass.human_attribute_name(name).html_safe
      else
        name.to_s.humanize
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
table_go-0.2.0 lib/table_go/column.rb
table_go-0.1.9 lib/table_go/column.rb