Class: Rage::Configuration::Deferred
- Inherits:
-
Object
- Object
- Rage::Configuration::Deferred
- Defined in:
- lib/rage/configuration.rb
Defined Under Namespace
Classes: Backpressure
Instance Attribute Summary collapse
-
#backpressure ⇒ Object
Returns the value of attribute backpressure.
Instance Method Summary collapse
- #backend ⇒ Object
- #backend=(config) ⇒ Object
- #configured? ⇒ Boolean
- #default_disk_storage_path ⇒ Object
- #default_disk_storage_prefix ⇒ Object
- #has_default_disk_storage? ⇒ Boolean
-
#initialize ⇒ Deferred
constructor
A new instance of Deferred.
Constructor Details
#initialize ⇒ Deferred
Returns a new instance of Deferred.
389 390 391 |
# File 'lib/rage/configuration.rb', line 389 def initialize @configured = false end |
Instance Attribute Details
#backpressure ⇒ Object
Returns the value of attribute backpressure.
387 388 389 |
# File 'lib/rage/configuration.rb', line 387 def backpressure @backpressure end |
Instance Method Details
#backend ⇒ Object
393 394 395 396 397 398 399 400 |
# File 'lib/rage/configuration.rb', line 393 def backend unless @backend_class @backend_class = Rage::Deferred::Backends::Disk @backend_options = ({}) end @backend_class.new(**@backend_options) end |
#backend=(config) ⇒ Object
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
# File 'lib/rage/configuration.rb', line 402 def backend=(config) @configured = true backend_id, opts = if config.is_a?(Array) [config[0], config[1]] else [config, {}] end @backend_class = case backend_id when :disk @backend_options = (opts) Rage::Deferred::Backends::Disk when nil Rage::Deferred::Backends::Nil else raise ArgumentError, "unsupported backend value; supported keys are `:disk` and `nil`" end end |
#configured? ⇒ Boolean
466 467 468 |
# File 'lib/rage/configuration.rb', line 466 def configured? @configured end |
#default_disk_storage_path ⇒ Object
454 455 456 |
# File 'lib/rage/configuration.rb', line 454 def default_disk_storage_path Pathname.new("storage") end |
#default_disk_storage_prefix ⇒ Object
458 459 460 |
# File 'lib/rage/configuration.rb', line 458 def default_disk_storage_prefix "deferred-" end |
#has_default_disk_storage? ⇒ Boolean
462 463 464 |
# File 'lib/rage/configuration.rb', line 462 def has_default_disk_storage? default_disk_storage_path.glob("#{default_disk_storage_prefix}*").any? end |