Class: AliceInvoice::Cache::Lazy
- Inherits:
-
Object
- Object
- AliceInvoice::Cache::Lazy
- Defined in:
- lib/alice_invoice/cache/lazy.rb
Constant Summary collapse
- SUPPORTED_API_VERSIONS =
[ 1 ]
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
Instance Method Summary collapse
- #event(type, data) ⇒ Object
- #implements_api_version?(int) ⇒ Boolean
-
#initialize(options = {}) ⇒ Lazy
constructor
A new instance of Lazy.
Constructor Details
#initialize(options = {}) ⇒ Lazy
Returns a new instance of Lazy.
8 9 10 |
# File 'lib/alice_invoice/cache/lazy.rb', line 8 def initialize( = {}) @debug = [:debug] end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug
6 7 8 |
# File 'lib/alice_invoice/cache/lazy.rb', line 6 def debug @debug end |
Instance Method Details
#event(type, data) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/alice_invoice/cache/lazy.rb', line 16 def event(type, data) if @debug puts "===>Cache" puts "got event #{type} with:" puts "link:" << data[:link] rescue '' puts "storage_path:" << data[:storage_path] rescue '' end if type == :not_in_cache needs_download?(data[:storage_path], data[:link]) else true end end |
#implements_api_version?(int) ⇒ Boolean
12 13 14 |
# File 'lib/alice_invoice/cache/lazy.rb', line 12 def implements_api_version?(int) SUPPORTED_API_VERSIONS.include?(int) end |