Class: BackgroundJobs::Sidekiq::StringAttribute

Inherits:
String
  • Object
show all
Defined in:
lib/background_jobs/strategies/sidekiq/job_attributes_adapter.rb

Instance Method Summary collapse

Instance Method Details

#decodeObject



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/background_jobs/strategies/sidekiq/job_attributes_adapter.rb', line 109

def decode
  if number?
    return to_i
  end

  if date?
    return Date.parse(gsub('date:', ''))
  end

  if range?
    matches = match(/range:\[(.*),(.*)\]/)
    return AttributeFactory.build(matches[1]).decode..AttributeFactory.build(matches[2]).decode
  end

  self
end