Module: SimpleSitemap
- Defined in:
- lib/simple_sitemap.rb,
lib/simple_sitemap/version.rb,
lib/simple_sitemap/generators/base.rb,
lib/simple_sitemap/generators/index.rb,
lib/simple_sitemap/generators/sitemap.rb,
lib/simple_sitemap/writers/gzip_writer.rb,
lib/simple_sitemap/writers/plain_writer.rb
Defined Under Namespace
Modules: Generators, Writers
Constant Summary collapse
- MAX_LINKS_PER_FILE =
50000- MAX_FILE_SIZE =
10 megabytes
10*1024*1024
- VERSION =
'0.1.4'
Class Attribute Summary collapse
-
.config ⇒ Object
Returns the value of attribute config.
-
.hooks ⇒ Object
Returns the value of attribute hooks.
Class Method Summary collapse
- .after_write(&block) ⇒ Object
- .build(opts = {}, &block) ⇒ Object
- .configure {|@config| ... } ⇒ Object
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
18 19 20 |
# File 'lib/simple_sitemap.rb', line 18 def config @config end |
.hooks ⇒ Object
Returns the value of attribute hooks.
18 19 20 |
# File 'lib/simple_sitemap.rb', line 18 def hooks @hooks end |
Class Method Details
.after_write(&block) ⇒ Object
36 37 38 39 |
# File 'lib/simple_sitemap.rb', line 36 def after_write(&block) @hooks ||= {} @hooks[:after_write] = block end |
.build(opts = {}, &block) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/simple_sitemap.rb', line 27 def build(opts={}, &block) config = OpenStruct.new(@config.marshal_dump.merge opts) start_time = Time.now generator = Generators::Sitemap.new config, @hooks generator.instance_eval &block generator.write! puts "Time taken: #{Time.now - start_time}" if config.verbose end |
.configure {|@config| ... } ⇒ Object
20 21 22 23 24 25 |
# File 'lib/simple_sitemap.rb', line 20 def configure(&block) @config = OpenStruct.new @config.gzip = true @config.verbose = false yield @config end |