lib/nanoc/toolbox/helpers/gravatar.rb
# Filters, Validates and build the options parameters for the URL.
# It simply consists in returning the URL query string based on the options passed
# after validating the availability the correctness of the option
#
# @example
#   {:size => 225, :rating => 'g', :ext => false, :secure => false}
#   #=> "?size=225&rating=g"
#
# @param [Hash] options the options to pass to the gravatar URL
# @option options [String] default_icon
# @option options [String] size (nil) Size of the image, between 1 to 512
# @option options [String] rating (nil) The rating allowed, a value in g, pg, r or x
# @option options [Boolean] ext (false) Use or not a file extension
# @option options [Boolean] secure (false) Use or not https
Filters, Validates and build the options parameters for the URL.
It simply consists in returning the URL query string based on the options passed
after validating the availability the correctness of the option
Filters Validates and build the options parameters for the URL . It simply consists in returning the URL query string based on the options passed after validating the availability the correctness of the option
def build_options_parameters(options={})
        options.delete_if {|key, value| !GRAVATAR_OPTIONS.include?(key) }
        return '' if options.empty?
        '?' + options.sort{|a,b| a.to_s <=> b.to_s}.map{ |e| e = e.join('=') if e.size == 2}.join('&')
      end
def build_options_parameters ( options = { } ) options . delete_if { | key , value | ! GRAVATAR_OPTIONS . include? ( key ) } return '' if options . empty? '?' + options . sort { | a , b | a . to_s <=> b . to_s } . map { | e | e = e . join ( '=' ) if e . size == 2 } . join ( '&' ) end
Filters, Validates and build the options parameters for the URL.
Filters Validates and build the options parameters for the URL .
# Remove unecessary options # Return now if the options hash is empty after cleanup # Build the parameters string
options
secure (false) Use or not https
secure ( false ) Use or not https
options the options to pass to the gravatar URL
options the options to pass to the gravatar URL
example
None