Sha256: 0cc060d6db2b265b47d6a8ea6b882aead5767a73beb70d0848fa8fd8ae601490

Contents?: true

Size: 585 Bytes

Versions: 12

Compression:

Stored size: 585 Bytes

Contents

module TableBuilder
  class Column
    attr_reader :name, :options

    def initialize(table, name, options = {})
      @table = table
      @name = name
      @value = options.delete(:value)
      @options = options.dup || {}
      @options[:class] ||= name
    end
    
    def content
      name.is_a?(Symbol) ? translate(name) : name
    end

    def translate(content)
      scope = [TableBuilder.options[:i18n_scope], @table.collection_name, :columns].compact
      I18n.t(content, :scope => scope)
    end
    
    def attribute_name
      name.to_s.underscore
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
adva-0.2.4 vendor/gems/table_builder/lib/table_builder/column.rb
adva-0.2.3 vendor/gems/table_builder/lib/table_builder/column.rb
adva-0.2.2 vendor/gems/table_builder/lib/table_builder/column.rb
adva-0.2.1 vendor/gems/table_builder/lib/table_builder/column.rb
adva-0.2.0 vendor/gems/table_builder/lib/table_builder/column.rb
adva-0.1.4 vendor/gems/table_builder/lib/table_builder/column.rb
adva-0.1.3 vendor/gems/table_builder/lib/table_builder/column.rb
adva-0.1.2 vendor/gems/table_builder/lib/table_builder/column.rb
adva-0.1.1 vendor/gems/table_builder/lib/table_builder/column.rb
adva-0.1.0 vendor/gems/table_builder/lib/table_builder/column.rb
adva_cms-0.0.1 vendor/gems/table_builder/lib/table_builder/column.rb
adva-0.0.1 adva_cms/vendor/gems/table_builder/lib/table_builder/column.rb