Class: BackgroundJobs::Sidekiq::Attribute
- Inherits:
-
Object
- Object
- BackgroundJobs::Sidekiq::Attribute
- Defined in:
- lib/background_jobs/strategies/sidekiq/job_attributes_adapter.rb
Instance Method Summary collapse
- #decode ⇒ Object
- #encode ⇒ Object
-
#initialize(value) ⇒ Attribute
constructor
A new instance of Attribute.
Constructor Details
#initialize(value) ⇒ Attribute
Returns a new instance of Attribute.
47 48 49 |
# File 'lib/background_jobs/strategies/sidekiq/job_attributes_adapter.rb', line 47 def initialize(value) @value = value end |
Instance Method Details
#decode ⇒ Object
51 52 53 |
# File 'lib/background_jobs/strategies/sidekiq/job_attributes_adapter.rb', line 51 def decode @value end |
#encode ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/background_jobs/strategies/sidekiq/job_attributes_adapter.rb', line 55 def encode case @value.class.name when 'Date' "date:#{@value.to_s}" when 'Hash' HashAttribute.new(@value).encode when 'Array' ArrayAttribute.new(@value).encode when 'Range' "range:[#{Attribute.new(@value.first).encode},#{Attribute.new(@value.last).encode}]" else @value end end |