Module: WindowState

Extended by:
Win32, Windows::Window
Includes:
Win32, Windows::Window
Defined in:
lib/windowstate.rb,
lib/windowstate/version.rb

Defined Under Namespace

Classes: WindowInfo, WindowPlacement

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.debugObject



195
196
197
198
# File 'lib/windowstate.rb', line 195

def debug
  EnumWindows(@debug_proc, nil)
  @debug
end

.get_stateObject



168
169
170
# File 'lib/windowstate.rb', line 168

def get_state
  EnumWindows(@save_proc, nil)
end

.get_state_jsonObject



172
173
174
175
# File 'lib/windowstate.rb', line 172

def get_state_json
  get_state
  JSON.generate(@wp_save, object_nl: "\n")
end

.restore(filename) ⇒ Object



191
192
193
# File 'lib/windowstate.rb', line 191

def restore(filename)
  set_state_json(File.read(filename))
end

.save(filename) ⇒ Object



185
186
187
188
189
# File 'lib/windowstate.rb', line 185

def save(filename)
  File.open(filename, "w") do |dump_file|
    dump_file.puts get_state_json
  end
end

.set_state(wp_array) ⇒ Object



177
178
179
# File 'lib/windowstate.rb', line 177

def set_state(wp_array)
  wp_array.each { |wp| wp.set }
end

.set_state_json(wp_json) ⇒ Object



181
182
183
# File 'lib/windowstate.rb', line 181

def set_state_json(wp_json)
  set_state(JSON.parse(wp_json))
end