Class: SiteMaps::AtomicRepository
- Inherits:
-
Object
- Object
- SiteMaps::AtomicRepository
- Defined in:
- lib/site_maps/atomic_repository.rb
Instance Attribute Summary collapse
-
#main_url ⇒ Object
readonly
Returns the value of attribute main_url.
-
#preloaded_index_links ⇒ Object
readonly
Returns the value of attribute preloaded_index_links.
Instance Method Summary collapse
- #generate_url(raw_location) ⇒ Object
-
#initialize(main_url) ⇒ AtomicRepository
constructor
A new instance of AtomicRepository.
- #remaining_index_links ⇒ Object
Constructor Details
#initialize(main_url) ⇒ AtomicRepository
Returns a new instance of AtomicRepository.
7 8 9 10 11 |
# File 'lib/site_maps/atomic_repository.rb', line 7 def initialize(main_url) @main_url = main_url @preloaded_index_links = Concurrent::Array.new @generated_urls = Concurrent::Hash.new end |
Instance Attribute Details
#main_url ⇒ Object (readonly)
Returns the value of attribute main_url.
5 6 7 |
# File 'lib/site_maps/atomic_repository.rb', line 5 def main_url @main_url end |
#preloaded_index_links ⇒ Object (readonly)
Returns the value of attribute preloaded_index_links.
5 6 7 |
# File 'lib/site_maps/atomic_repository.rb', line 5 def preloaded_index_links @preloaded_index_links end |
Instance Method Details
#generate_url(raw_location) ⇒ Object
13 14 15 16 |
# File 'lib/site_maps/atomic_repository.rb', line 13 def generate_url(raw_location) location = IncrementalLocation.new(main_url, raw_location) (@generated_urls[location.relative_directory] ||= location).next.url end |
#remaining_index_links ⇒ Object
18 19 20 21 22 |
# File 'lib/site_maps/atomic_repository.rb', line 18 def remaining_index_links preloaded_index_links.reject do |link| @generated_urls.key?(link.relative_directory) end end |