Class: Again
- Inherits:
-
Object
- Object
- Again
- Includes:
- Singleton
- Defined in:
- lib/again.rb,
lib/again/extras.rb,
lib/again/version.rb
Constant Summary collapse
- RELOAD_MARKER =
"--reload-temp--"
- VERSION =
"1.1.4"
Class Method Summary collapse
- .join ⇒ Object
- .open_cmd ⇒ Object
- .open_lib(lib, cmd = open_cmd) ⇒ Object
- .open_libdir(lib, cmd = open_cmd) ⇒ Object
- .reloaded? ⇒ Boolean
- .start ⇒ Object
Instance Method Summary collapse
Class Method Details
.join ⇒ Object
18 |
# File 'lib/again.rb', line 18 def self.join() instance.join end |
.open_cmd ⇒ Object
2 3 4 |
# File 'lib/again/extras.rb', line 2 def self.open_cmd() (`which mate` rescue nil || "open").chomp end |
.open_lib(lib, cmd = open_cmd) ⇒ Object
6 7 8 9 10 |
# File 'lib/again/extras.rb', line 6 def self.open_lib(lib, cmd=open_cmd) if lib = instance.resolve_library(lib) then system(cmd, lib) end end |
.open_libdir(lib, cmd = open_cmd) ⇒ Object
12 13 14 15 16 |
# File 'lib/again/extras.rb', line 12 def self.open_libdir(lib, cmd=open_cmd) if lib = instance.resolve_library(lib) then system(cmd, File.dirname(lib)) end end |
.reloaded? ⇒ Boolean
19 |
# File 'lib/again.rb', line 19 def self.reloaded?() instance.reloaded? end |
.start ⇒ Object
17 |
# File 'lib/again.rb', line 17 def self.start() self.instance end |
Instance Method Details
#join ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/again.rb', line 23 def join() # Can't simply join @watch_thread here as a refresh() can stop it. # We want to survive refreshes so we instead join a thread which # keeps checking for new watch_threads... Thread.new do loop do if @watch_thread then @watch_thread.alive?() ? @watch_thread.join : sleep(0.5) end end end.join end |
#reloaded? ⇒ Boolean
21 |
# File 'lib/again.rb', line 21 def reloaded?() @reloaded end |