WpTimthumb::Versionable specs

This commit is contained in:
erwanlr
2013-03-26 17:12:57 +01:00
parent 65ca256a73
commit be0aad2c66
3 changed files with 62 additions and 3 deletions

View File

@@ -5,11 +5,17 @@ class WpTimthumb < WpItem
# Get the version from the body of an invalid request
# See https://code.google.com/p/timthumb/source/browse/trunk/timthumb.php#426
#
# @return [ String ] The version
def version
response = Browser.instance.get(url)
response.body[%r{TimThumb version\s*: ([^<]+)} , 1]
unless @version
response = Browser.instance.get(url)
@version = response.body[%r{TimThumb version\s*: ([^<]+)} , 1]
end
@version
end
# @return [ String ]
def to_s
"#{url}#{ ' v' + version if version}"
end