Class: Shoes::App

Inherits:
Object
  • Object
show all
Defined in:
lib/clogs/lacci_compat.rb

Overview

Small pieces of the Shoes API that Lacci 0.5.0 does not implement but that real Shoes programs use constantly. Each is defined only if the installed Lacci lacks it, so newer versions win.

Instance Method Summary collapse

Instance Method Details

#clear(&block) ⇒ Object



11
12
13
14
# File 'lib/clogs/lacci_compat.rb', line 11

def clear(&block)
  root = instance_variable_get(:@document_root)
  root&.clear(&block)
end

#clipboardObject



40
41
42
# File 'lib/clogs/lacci_compat.rb', line 40

def clipboard
  Clogs::Clipboard.read
end

#clipboard=(text) ⇒ Object



44
45
46
# File 'lib/clogs/lacci_compat.rb', line 44

def clipboard=(text)
  Clogs::Clipboard.write(text.to_s)
end

#mouseObject



20
21
22
# File 'lib/clogs/lacci_compat.rb', line 20

def mouse
  Clogs::App.instance&.mouse_state || [0, 0, 0]
end

#visit(url) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/clogs/lacci_compat.rb', line 28

def visit(url)
  opener = case RUBY_PLATFORM
  when /darwin/ then "open"
  when /mingw|mswin/ then "start"
  else "xdg-open"
  end
  system(opener, url.to_s, out: File::NULL, err: File::NULL)
end