Sha256: 9c287178cff3b65de894897461aa13fff2d965c83d6af295ff397a095c630ef2

Contents?: true

Size: 689 Bytes

Versions: 2

Compression:

Stored size: 689 Bytes

Contents

module TableCloth
  class Configuration
    cattr_accessor :table
    cattr_accessor :thead
    cattr_accessor :th
    cattr_accessor :tbody
    cattr_accessor :tr
    cattr_accessor :td

    self.table = ActiveSupport::OrderedOptions.new
    self.thead = ActiveSupport::OrderedOptions.new
    self.th    = ActiveSupport::OrderedOptions.new
    self.tbody = ActiveSupport::OrderedOptions.new
    self.tr    = ActiveSupport::OrderedOptions.new
    self.td    = ActiveSupport::OrderedOptions.new

    class << self
      def configure(&block)
        block.arity > 0 ? block.call(self) : yield
      end

      def config_for(type)
        self.send(type).to_hash
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
table_cloth-0.1.1 lib/table_cloth/configuration.rb
table_cloth-0.1.0 lib/table_cloth/configuration.rb