Sha256: ca40fc1bd34293fbc68ca8f4533e563a5b703a7aa7f9a3334630149d196085bc

Contents?: true

Size: 557 Bytes

Versions: 9

Compression:

Stored size: 557 Bytes

Contents

module TableHelp
  module Helper
    def table_for(collection_or_resource, options = {})
      resolve_builder_from(collection_or_resource, options).tap { |this| yield this }.to_html
    end

    alias_method :attributes_table_for, :table_for

    private

      def resolve_builder_from(collection_or_resource, options)
        if collection_or_resource.respond_to?(:to_model)
          AttributesTableFor.new(collection_or_resource, self, options)
        else
          TableFor.new(collection_or_resource, self, options)
        end
      end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
table_help-0.2.0 lib/table_help/helper.rb
table_help-0.1.7 lib/table_help/helper.rb
table_help-0.1.6 lib/table_help/helper.rb
table_help-0.1.5 lib/table_help/helper.rb
table_help-0.1.4 lib/table_help/helper.rb
table_help-0.1.3 lib/table_help/helper.rb
table_help-0.1.2 lib/table_help/helper.rb
table_help-0.1.1 lib/table_help/helper.rb
table_help-0.1.0 lib/table_help/helper.rb