Sha256: 3545178ee4246640e23178b81a4d8e442f8868275ff171560aa20c58ea544b60

Contents?: true

Size: 604 Bytes

Versions: 6

Compression:

Stored size: 604 Bytes

Contents

require 'facades/builders/table'

module Facades
  module Helpers
    module Builders

      def table_for(resource_or_class, *args, &block)
        options    = args.extract_options!
        html_attrs = options.delete(:html)
        builder    = options.delete(:builder) || TableBuilder
        builder    = builder.new(resource_or_class, self, options)
        
        unless block_given?
          content_tag(:table, builder.inline!, html_attrs)
        else
          content_tag(:table, html_attrs) do
            yield builder
          end
        end        
      end
      
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
facades-0.1.0 lib/facades/helpers/builders.rb
facades-0.0.7 lib/facades/helpers/builders.rb
facades-0.0.6 lib/facades/helpers/builders.rb
facades-0.0.5 lib/facades/helpers/builders.rb
facades-0.0.4 lib/facades/helpers/builders.rb
facades-0.0.3 lib/facades/helpers/builders.rb