absolutize 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
 
2
- h1. Absolutize v0.0.3
2
+ h1. Absolutize v0.0.4
3
3
 
4
4
  h2. Intro
5
5
 
@@ -22,6 +22,7 @@ Creates a new absolutize object based on a base_url
22
22
  * options - Options are passed in as a hash,
23
23
  ** :remove_anchors - removes any anchor tags (false)
24
24
  ** :force_escaping - forces escaping of urls if it hasn't been done already (true)
25
+ ** :output_debug - puts debug info while processing the url (false)
25
26
 
26
27
  bq. absolutizer = Absolutize.new("http://www.vamosa.com/mainfolder/", :remove_anchors => true)
27
28
 
@@ -56,4 +57,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
56
57
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
57
58
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
58
59
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
59
- THE SOFTWARE.
60
+ THE SOFTWARE.
@@ -16,7 +16,7 @@ class Absolutize
16
16
  def url(new_url)
17
17
  # encode the url if the new url contains spaces but doesn't contain %, i.e isn't already encoded
18
18
  new_url = new_url.split("#").first if new_url.include?"#" and @options[:remove_anchors]
19
- new_url = new_url.gsub("//", "/") if @options[:force_escaping]
19
+
20
20
  new_url = URI.encode(new_url, " <>\{\}|\\\^\[\]`") if not new_url =~ /%/ and @options[:force_escaping]
21
21
  begin
22
22
  URI.join(@base_url, new_url).to_s
@@ -16,7 +16,7 @@ class Absolutize
16
16
  def url(new_url)
17
17
  # encode the url if the new url contains spaces but doesn't contain %, i.e isn't already encoded
18
18
  new_url = new_url.split("#").first if new_url.include?"#" and @options[:remove_anchors]
19
- new_url = new_url.gsub("//", "/") if @options[:force_escaping]
19
+
20
20
  new_url = URI.encode(new_url, " <>\{\}|\\\^\[\]`") if not new_url =~ /%/ and @options[:force_escaping]
21
21
  begin
22
22
  URI.join(@base_url, new_url).to_s
@@ -36,6 +36,6 @@ class Absolutize
36
36
  else
37
37
  raise "Unable to absolutize #{base_url} and #{new_url}"
38
38
  end
39
- end
39
+ end
40
40
  end
41
41
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: absolutize
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Stewart McKee
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-04 00:00:00 +01:00
18
+ date: 2010-08-05 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21