quick_response 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
data/lib/quick_response/base.rb
CHANGED
@@ -10,8 +10,8 @@ module QuickResponse
|
|
10
10
|
# Extract options
|
11
11
|
options = args.last.is_a?(Hash) ? DEFAULT_OPTIONS.merge(args.pop) : DEFAULT_OPTIONS
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
@content = to_format(args)
|
14
|
+
@size = options[:size]
|
15
15
|
end
|
16
16
|
|
17
17
|
def content=(*args)
|
@@ -58,6 +58,7 @@ module QuickResponse
|
|
58
58
|
def self.format(format, options = {})
|
59
59
|
define_method :to_format do |args|
|
60
60
|
args = args.slice(0, options[:limit]) if options[:limit]
|
61
|
+
args = args.map { |a| CGI.escape(a) } if options[:query]
|
61
62
|
output = options[:output] || format
|
62
63
|
str = args.join(options[:join])
|
63
64
|
|
@@ -1,10 +1,5 @@
|
|
1
1
|
module QuickResponse
|
2
2
|
class Maps < ::QuickResponse::Base
|
3
|
-
format "http://maps.google.com/maps?q=(.*)", :limit => 1
|
4
|
-
|
5
|
-
def initialize(*args)
|
6
|
-
args = args.map { |a| CGI.escape(a) }
|
7
|
-
super(*args)
|
8
|
-
end
|
3
|
+
format "http://maps.google.com/maps?q=(.*)", :limit => 1, :query => true
|
9
4
|
end
|
10
5
|
end
|