lib/flickr_mocks/api/sanitize.rb in flickrmocks-0.9.0 vs lib/flickr_mocks/api/sanitize.rb in flickrmocks-0.9.1
- old
+ new
@@ -1,11 +1,12 @@
module FlickrMocks
class Api
# helper methods that help to clean up user supplied values. Module is
# used internally.
module Sanitize
- # returns a lowercase stripped version of the supplied comma separated string. Sample usage:
+ # returns a lowercase stripped version of the supplied comma separated string.
+ # Sample usage:
#
# Api.sanitize_tags('Shiraz , HeLLo goodbye, wow')
# returns 'shiraz,hello goodbye,wow'
def self.tags(value=nil)
case value
@@ -16,12 +17,12 @@
else
raise ArgumentError
end
end
- # returns lowercase stripped version of the supplied string stored in the :search_terms key of the
- # supplied hash. Sample usage:
+ # returns lowercase stripped version of the supplied string stored in the
+ # :search_terms key of the supplied hash. Sample usage:
#
# self.sanitize_tags(:search_terms => 'Shiraz , HeLLo goodbye, wow')
# returns 'shiraz,hello goodbye,wow'
def self.tags_hash(options={})
raise ArgumentError unless options.is_a?(Hash)
@@ -60,11 +61,12 @@
self.per_page(nil)
end
end
# returns the page number. Ensures that return value is string containing an integer
- # greater than 0. When nonsensical page supplied, default page '1' is returned. Sample usage:
+ # greater than 0. When nonsensical page supplied, default page '1' is returned.
+ # Sample usage:
#
# self.page('20')
# returns '20'
def self.page(value={})
case value
@@ -77,11 +79,12 @@
else
raise ArgumentError
end
end
- # returns the page number contained in the :page key of the supplied hash. Sample usage:
+ # returns the page number contained in the :page key of the supplied hash.
+ # Sample usage:
#
# self.page(:page => '20')
# returns '20'
def self.page_hash(options={})
self.page(options[:page])
@@ -102,10 +105,11 @@
else
raise ArgumentError
end
end
- # returns tag_mode contained in the :tag_mode key of the supplied hash. Sample usage:
+ # returns tag_mode contained in the :tag_mode key of the supplied hash.
+ # Sample usage:
#
# self.tag_mode(:tag_mode => 'any')
# returns 'any'
def self.tag_mode_hash(options={})
self.tag_mode(options[:tag_mode].to_s.downcase.strip)