def attribute(*args, &block)
      options = args.extract_options!
      options.reverse_merge!(Attrtastic.default_options)
      options[:html] ||= {}

      method = args.shift

      html_label_class = [ "label", options[:html][:label_class] ].compact.join(" ")
      html_value_class = [ "value", options[:html][:value_class] ].compact.join(" ")
      html_class = [ "attribute", options[:html][:class] ].compact.join(" ")

      label = options.key?(:label) ? options[:label] : label_for_attribute(method)

      if block_given?
        output = template.tag(:li, {:class => html_class}, true)
        output << template.content_tag(:span, label, :class => html_label_class)
        output << template.tag(:span, {:class => html_value_class}, true)
        output << template.capture(&block)
        output.safe_concat("</span>")
        output.safe_concat("</li>")
      else
        value = if options.key?(:value)
                  case options[:value]
                  when Symbol
                    attribute_value = value_of_attribute(method)
                    case attribute_value
                    when Hash
                      attribute_value[options[:value]]
                    else
                      attribute_value.send(options[:value])
                    end
                  else
                    options[:value]
                  end
                else
                  value_of_attribute(method)
                end

        value = case options[:format]
                when false
                  value
                when nil
                  format_attribute_value(value)
                else
                  format_attribute_value(value, options[:format])
                end

        if value.present? || options[:display_empty]
          output = template.tag(:li, {:class => html_class}, true)
          output << template.content_tag(:span, label, :class => html_label_class)
          output << template.content_tag(:span, value, :class => html_value_class)
          output.safe_concat("</li>")
        end
      end
    end
def attribute(*args, &block)
      options = args.extract_options!
      options.reverse_merge!(Attrtastic.default_options)
      options[:html] ||= {}

      method = args.shift

      html_label_class = [ "label", options[:html][:label_class] ].compact.join(" ")
      html_value_class = [ "value", options[:html][:value_class] ].compact.join(" ")
      html_class = [ "attribute", options[:html][:class] ].compact.join(" ")

      label = options.key?(:label) ? options[:label] : label_for_attribute(method)

      if block_given?
        output = template.tag(:li, {:class => html_class}, true)
        output << template.content_tag(:span, label, :class => html_label_class)
        output << template.tag(:span, {:class => html_value_class}, true)
        output << template.capture(&block)
        output.safe_concat("</span>")
        output.safe_concat("</li>")
      else
        value = if options.key?(:value)
                  case options[:value]
                  when Symbol
                    attribute_value = value_of_attribute(method)
                    case attribute_value
                    when Hash
                      attribute_value[options[:value]]
                    else
                      attribute_value.send(options[:value])
                    end
                  else
                    options[:value]
                  end
                else
                  value_of_attribute(method)
                end

        value = case options[:format]
                when false
                  value
                when nil
                  format_attribute_value(value)
                else
                  format_attribute_value(value, options[:format])
                end

        if value.present? || options[:display_empty]
          output = template.tag(:li, {:class => html_class}, true)
          output << template.content_tag(:span, label, :class => html_label_class)
          output << template.content_tag(:span, value, :class => html_value_class)
          output.safe_concat("</li>")
        end
      end
    end
Creates list entry for single record attribute

 @overload attribute(method, options = {})
   Creates entry for record attribute

   @param [Symbol] method Attribute name of given record
   @param [Hash] options Options
   @option options [Hash] :html ({}) Hash with optional :class, :label_class and :value_class names of class for html
   @option options [String] :label Label for attribute entry, overrides default label name from symbol
   @option options [Symbol,Object] :value If it's Symbol, then it's used as either name of hash key to use on attribute
           (if it's hash) or method name to call on attribute. Otherwise it's used as value to use instead of
           actual attribute's.
   @option options [Boolean] :display_empty (false) Indicates if print value of given attribute even if it is blank?
   @option options [Symbol,false,nil] :format (nil) Type of formatter to use to display attribute's value. If it's false,
           then don't format at all (just call #to_s). If it's nil, then use default formatting (#l for dates,
           #number_with_precision/#number_with_delimiter for floats/integers). If it's Symbol, then use it to select
           view helper method and pass aattribute's value to it to format.

   @example
     <%= attr.attribute :name %>

   @example
     <%= attr.attribute :name, :label => "Full user name" %>

   @example
     <%= attr.attribute :name, :value => @user.full_name %>

   @example
     <%= attr.attribute :address, :value => :street %>

   @example
     <%= attr.attribute :avatar, :value => :url, :format => :image_tag %>

 @overload attribute(method, options = {}, &block)
   Creates entry for attribute given with block

   @param [Symbol] method Attribute name of given record
   @param [Hash] options Options
   @option options [Hash] :html ({}) Hash with optional :class, :label_class and :value_class names of classes for html
   @option options [String] :label Label for attribute entry, overrides default label name from symbol
   @yield Block which is executed in place of value for attribute

   @example
     <%= attr.attribute :name do %>
       <%= link_to @user.full_name, user_path(@user) %>

 @overload attribute(options = {}, &block)
   Creates entry for attribute with given block, options[:label] is mandatory in this case.

   @param [:Hash] options Options
   @option options [Hash] :html ({}) Hash with optional :class, :label_class and :value_class names of classes for html
   @option options [String] :label Mandatory label for attribute entry
   @yield Block which is executed in place of value for attribute

   @example
     <%= attr.attribute :label => "User link" do %>
       <%= link_to @user.full_name, user_path(@user) %>

 @example
   <%= attr.attribute :name, :display_empty => true %>

 @example
   <%= attr.attribute :label => "User link" do %>
     <%= link_to @user.full_name, user_path(@user) %>

 Options can be set globally with Attrtastic.default_options