Class: MonitorLastUsedDir
- Inherits:
-
Object
- Object
- MonitorLastUsedDir
- Defined in:
- lib/a-core.rb
Overview
receives messages and tracks the by Roger D. Pack
Class Method Summary collapse
- .get_last_dir ⇒ Object
-
.set_last(to_this) ⇒ Object
TODO set as private…
Instance Method Summary collapse
-
#initialize ⇒ MonitorLastUsedDir
constructor
A new instance of MonitorLastUsedDir.
- #on_after_ack_in_files(_event) ⇒ Object (also: #on_after_search_in_files)
-
#on_after_open_buffer(_event) ⇒ Object
we want this one…but…not at startup time…hmm.
- #on_after_save_as_buffer(_event) ⇒ Object
Constructor Details
#initialize ⇒ MonitorLastUsedDir
Returns a new instance of MonitorLastUsedDir.
3683 3684 3685 3686 3687 |
# File 'lib/a-core.rb', line 3683 def initialize for event in [SaveBufferEvent, AckInFilesEvent, SearchInFilesEvent, OpenBufferEvent] do Arcadia.attach_listener(self, event) end end |
Class Method Details
.get_last_dir ⇒ Object
3704 3705 3706 3707 3708 3709 3710 3711 |
# File 'lib/a-core.rb', line 3704 def self.get_last_dir current = $arcadia['pers']['last.used.dir'] if current != nil && current != '' current else $pwd # startup dir end end |
.set_last(to_this) ⇒ Object
TODO set as private…
3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 |
# File 'lib/a-core.rb', line 3713 def MonitorLastUsedDir.set_last to_this # TODO set as private... return if to_this.nil? or to_this == '' if(File.directory?(to_this)) to_this_dir = to_this elsif File.directory? File.dirname(to_this) # filename, to_this_dir = File.dirname(to_this) end $arcadia['pers']['last.used.dir'] = File.(to_this_dir) end |
Instance Method Details
#on_after_ack_in_files(_event) ⇒ Object Also known as: on_after_search_in_files
3693 3694 3695 |
# File 'lib/a-core.rb', line 3693 def on_after_ack_in_files _event MonitorLastUsedDir.set_last _event.dir end |
#on_after_open_buffer(_event) ⇒ Object
we want this one…but…not at startup time…hmm.
3698 3699 3700 |
# File 'lib/a-core.rb', line 3698 def on_after_open_buffer _event MonitorLastUsedDir.set_last _event.file end |
#on_after_save_as_buffer(_event) ⇒ Object
3689 3690 3691 |
# File 'lib/a-core.rb', line 3689 def on_after_save_as_buffer(_event) MonitorLastUsedDir.set_last _event.new_file end |