Module: SciTE::Session
- Defined in:
- lib/scite/session.rb,
lib/scite/session/version.rb
Overview
Save and restore a SciTE sessions layout.
Constant Summary collapse
- VERSION =
"0.1.2"
Class Method Summary collapse
- .restore(windows: nil, layout: nil) ⇒ Object
-
.save(windows, layout:, append: false) ⇒ Object
Save session @ windows : Array(SciTE::Window) : Save session @ layout : String : session layout yml-file name (w/o extension) @ append : Boolean : add a window record to the layout yml instead of overwrite it (default: false).
Class Method Details
.restore(windows: nil, layout: nil) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/scite/session.rb', line 46 def restore(windows: nil, layout: nil) if layout windows = load_layout(layout) end windows.map! {|params| if params.is Window params else params[:session] = find_session_file(params[:session], layout) Window.new **params end } windows.each {|w| w.create sleep 0.1 } windows.each &:wait end |
.save(windows, layout:, append: false) ⇒ Object
Save session @ windows : Array(SciTE::Window) : Save session @ layout : String : session layout yml-file name (w/o extension) @ append : Boolean : add a window record to the layout yml instead of overwrite it (default: false)
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/scite/session.rb', line 35 def save(windows, layout:, append: false) window_configs = windows.map {|win| {session: win.session, title: win.title, move_to: win.position} } if append window_configs = load_layout(layout) + window_configs end File.write "#{layouts_home}/#{layout}.yml", window_configs.to_yaml end |