Module: Synctest::Patches::TimeSingletonPatch
- Defined in:
- lib/synctest/patches.rb
Instance Method Summary collapse
Instance Method Details
#new(*arguments, **keywords) ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/synctest/patches.rb', line 36 def new(*arguments, **keywords) bubble = Synctest.current_bubble if bubble && arguments.empty? && (keywords.empty? || keywords.keys == [:in]) value = bubble.wall_time zone = keywords[:in] return zone ? value.getlocal(zone) : value end super end |
#now(**keywords) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/synctest/patches.rb', line 26 def now(**keywords) bubble = Synctest.current_bubble return super unless bubble return super unless keywords.empty? || keywords.keys == [:in] value = bubble.wall_time zone = keywords[:in] zone ? value.getlocal(zone) : value end |