Class: Indexmap::IndexNowConfiguration
- Inherits:
-
Object
- Object
- Indexmap::IndexNowConfiguration
- Defined in:
- lib/indexmap/index_now_configuration.rb
Constant Summary collapse
- DEFAULT_ENDPOINT =
"https://api.indexnow.org"- DEFAULT_MAX_URLS_PER_REQUEST =
500
Instance Attribute Summary collapse
-
#dry_run ⇒ Object
writeonly
Sets the attribute dry_run.
- #endpoint ⇒ Object
- #key ⇒ Object
- #key_path(public_path:) ⇒ Object
- #max_urls_per_request ⇒ Object
Instance Method Summary collapse
Instance Attribute Details
#dry_run=(value) ⇒ Object (writeonly)
Sets the attribute dry_run
8 9 10 |
# File 'lib/indexmap/index_now_configuration.rb', line 8 def dry_run=(value) @dry_run = value end |
#endpoint ⇒ Object
15 16 17 |
# File 'lib/indexmap/index_now_configuration.rb', line 15 def endpoint resolve(@endpoint).presence || DEFAULT_ENDPOINT end |
#key ⇒ Object
19 20 21 |
# File 'lib/indexmap/index_now_configuration.rb', line 19 def key resolve(@key) end |
#key_path(public_path:) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/indexmap/index_now_configuration.rb', line 23 def key_path(public_path:) configured_path = resolve(@key_path) return Pathname(configured_path) if configured_path.present? return if key.to_s.strip.empty? Pathname(public_path).join("#{key}.txt") end |
#max_urls_per_request ⇒ Object
31 32 33 34 35 36 |
# File 'lib/indexmap/index_now_configuration.rb', line 31 def max_urls_per_request value = resolve(@max_urls_per_request) return DEFAULT_MAX_URLS_PER_REQUEST if value.nil? value.to_i end |
Instance Method Details
#dry_run? ⇒ Boolean
10 11 12 13 |
# File 'lib/indexmap/index_now_configuration.rb', line 10 def dry_run? value = resolve(@dry_run) value == true || value.to_s == "1" end |