xml-sitemap 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,7 @@ require 'time'
2
2
  require 'date'
3
3
  require 'zlib'
4
4
  require 'builder'
5
+ require 'cgi'
5
6
  begin
6
7
  require 'nokogiri'
7
8
  rescue LoadError
@@ -2,6 +2,8 @@ module XmlSitemap
2
2
  class Index
3
3
  attr_reader :maps
4
4
 
5
+ # Initialize a new Index instance
6
+ #
5
7
  def initialize(opts={})
6
8
  @maps = []
7
9
  @offsets = Hash.new(0)
@@ -10,6 +12,9 @@ module XmlSitemap
10
12
  end
11
13
 
12
14
  # Add map object to index
15
+ #
16
+ # map - XmlSitemap::Map instance
17
+ #
13
18
  def add(map)
14
19
  raise ArgumentError, 'XmlSitemap::Map object requred!' unless map.kind_of?(XmlSitemap::Map)
15
20
  raise ArgumentError, 'Map is empty!' if map.empty?
@@ -22,6 +27,7 @@ module XmlSitemap
22
27
  end
23
28
 
24
29
  # Generate sitemap XML index
30
+ #
25
31
  def render
26
32
  xml = Builder::XmlMarkup.new(:indent => 2)
27
33
  xml.instruct!(:xml, :version => '1.0', :encoding => 'UTF-8')
@@ -36,8 +42,14 @@ module XmlSitemap
36
42
  end
37
43
 
38
44
  # Render XML sitemap index into the file
39
- def render_to(path, opts={})
40
- overwrite = opts[:overwrite] || true
45
+ #
46
+ # path - Output filename
47
+ # options - Options hash
48
+ #
49
+ # options[:ovewrite] - Overwrite file contents (default: true)
50
+ #
51
+ def render_to(path, options={})
52
+ overwrite = options[:overwrite] || true
41
53
  path = File.expand_path(path)
42
54
 
43
55
  if File.exists?(path) && !overwrite
@@ -105,6 +105,12 @@ module XmlSitemap
105
105
 
106
106
  # Render XML sitemap into the file
107
107
  #
108
+ # path - Output filename
109
+ # options - Options hash
110
+ #
111
+ # options[:overwrite] - Overwrite the file contents (default: true)
112
+ # options[:gzip] - Gzip file contents (default: false)
113
+ #
108
114
  def render_to(path, options={})
109
115
  overwrite = options[:overwrite] == true || true
110
116
  compress = options[:gzip] == true || false
@@ -19,6 +19,6 @@ module XmlSitemap
19
19
  INDEX_SCHEMA_OPTIONS = {
20
20
  'xsi:schemaLocation' => "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd",
21
21
  'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance",
22
- 'xmlns' => "http://www.sitemaps.org/schemas/sitemap/0.9"
22
+ 'xmlns' => "http://www.sitemaps.org/schemas/sitemap/0.9"
23
23
  }.freeze
24
24
  end
@@ -1,3 +1,3 @@
1
1
  module XmlSitemap
2
- VERSION = '1.2.1'
2
+ VERSION = '1.2.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml-sitemap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-24 00:00:00.000000000Z
12
+ date: 2011-10-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &2153030780 !ruby/object:Gem::Requirement
16
+ requirement: &2166022840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.8'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2153030780
24
+ version_requirements: *2166022840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &2153029200 !ruby/object:Gem::Requirement
27
+ requirement: &2166022080 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2.6'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2153029200
35
+ version_requirements: *2166022080
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: simplecov
38
- requirement: &2153028680 !ruby/object:Gem::Requirement
38
+ requirement: &2166021560 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.4'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2153028680
46
+ version_requirements: *2166021560
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: nokogiri
49
- requirement: &2153028180 !ruby/object:Gem::Requirement
49
+ requirement: &2166021100 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.5.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2153028180
57
+ version_requirements: *2166021100
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: builder
60
- requirement: &2153027140 !ruby/object:Gem::Requirement
60
+ requirement: &2166020560 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '2.0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2153027140
68
+ version_requirements: *2166020560
69
69
  description: Provides a wrapper to generate XML sitemaps and sitemap indexes.
70
70
  email:
71
71
  - dan.sosedoff@gmail.com