Module: LRE
- Defined in:
- lib/lre.rb
Class Method Summary collapse
- .add_watch_dir(*ds) ⇒ Object
- .from_cli!(f) ⇒ Object
- .load_config! ⇒ Object
- .on_every_file(&b) ⇒ Object
- .start! ⇒ Object
- .start_irb! ⇒ Object
- .stop! ⇒ Object
- .watch(pattern, &b) ⇒ Object
Class Method Details
.add_watch_dir(*ds) ⇒ Object
12 13 14 15 16 |
# File 'lib/lre.rb', line 12 def add_watch_dir(*ds) [ds].flatten.each do |d| self.watch_dirs << d end end |
.from_cli!(f) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/lre.rb', line 29 def from_cli!(f) if f load_config! load(f) else start! end end |
.load_config! ⇒ Object
17 18 19 20 21 22 |
# File 'lib/lre.rb', line 17 def load_config! config_files = ["~/.lre","#{Dir.getwd}/.lre"] config_files.each do |f| load(f) if FileTest.exists?(f) end end |
.on_every_file(&b) ⇒ Object
49 50 51 |
# File 'lib/lre.rb', line 49 def on_every_file(&b) FileReload.on_every_file = b end |
.start! ⇒ Object
37 38 39 40 41 42 |
# File 'lib/lre.rb', line 37 def start! load_config! FileReload.run! start_irb! end |
.start_irb! ⇒ Object
23 24 25 26 27 28 |
# File 'lib/lre.rb', line 23 def start_irb! return if @start_irb require 'irb' @start_irb = true IRB.start end |
.stop! ⇒ Object
43 44 45 |
# File 'lib/lre.rb', line 43 def stop! FileReload.stop! end |
.watch(pattern, &b) ⇒ Object
46 47 48 |
# File 'lib/lre.rb', line 46 def watch(pattern,&b) FileReload.watches[pattern] = b end |