Module: FallsBackOn
- Defined in:
- lib/falls_back_on.rb,
lib/falls_back_on/version.rb,
lib/falls_back_on/definition.rb,
lib/falls_back_on/definition/storage.rb
Defined Under Namespace
Classes: Definition
Constant Summary collapse
- VERSION =
'0.1.4'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.clear ⇒ Object
9 10 11 |
# File 'lib/falls_back_on.rb', line 9 def self.clear ::FallsBackOn::Definition.all.each { |definition| definition.clear } end |
Instance Method Details
#fallback ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/falls_back_on.rb', line 18 def fallback obj = new definition = ::FallsBackOn::Definition.new self begin definition.attrs.each do |k, v| obj.send "#{k}=", v end rescue ::LockMethod::Locked $stderr.puts "#{self.to_s} fallback calculation was locked, retrying in 0.5 seconds..." if ::ENV['FALLS_BACK_ON_DEBUG'] == 'true' sleep 0.5 retry end obj end |
#falls_back_on(attrs) ⇒ Object
13 14 15 16 |
# File 'lib/falls_back_on.rb', line 13 def falls_back_on(attrs) definition = ::FallsBackOn::Definition.new self definition.attrs = attrs end |