rubytext 0.0.52 → 0.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c70e2361d174352a8b4bd66080a08636c41afb2e4caffc72dd1583aa1339f70
4
- data.tar.gz: b84934ee1a6fe52023bfe6c2d80ed2c5265441d021841c1ac0bcd4d2abba3cbf
3
+ metadata.gz: db3eb662edeaaf44456c062353906a426018b8901cd2993b6d1f95b4716f7461
4
+ data.tar.gz: 868861d08490f9f3923336761cf8a8447969b60fbe4c8dd01863f72014f6e49a
5
5
  SHA512:
6
- metadata.gz: 6e0017838a8c4b56f9bba9858438c84b0d72b5343bed1791fb17c5c99db9c8db8578928c00f5496a3c6bbc6730a9c34df24d891aab8cdf1f7dbd76cc2f44bd9d
7
- data.tar.gz: 3b4ec8017fd0b6fe286d786eaa34f291fb878f2e89ad8b68ce23cfb0d4a815c4872d44bc758534c47e8e19921fe07334989d50a69b8cd3fb0d3f9eb5104936e3
6
+ metadata.gz: 51bf39bda0424bd55f335ac03a234a5520b8e44f87526879b7b4c4e02915e696748925856cc650b79848e45e1d2fa72c77cf799fd8c287b2039e04adb880cacd
7
+ data.tar.gz: b60cf035089e2f11d8c3359816d76648cee9ffb2c7d56156923c1500d51bd7c7880012976e044566f4a6452a6d551ca93e4fbe62ea31a1fc6bb9da0003af55a8
data/examples/prog01.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  win = RubyText.window(6, 25, 2, 34,
2
2
  # 6 rows, 25 cols; upper left at 2,4
3
- true, # has a border
4
3
  fg: Blue, bg: White) # foreground, background
5
4
 
6
5
  win.puts "This is a window..."
data/examples/prog02.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(9, 36, 2, 6, true, fg: White, bg: Red)
1
+ win = RubyText.window(9, 36, 2, 6, fg: White, bg: Red)
2
2
 
3
3
  win.output do
4
4
  puts "Because this code uses #output,"
data/examples/prog03.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(9, 35, 3, 7, false, fg: Black, bg: Green)
1
+ win = RubyText.window(9, 35, 3, 7, border: false, fg: Black, bg: Green)
2
2
 
3
3
  win.puts "A window doesn't have to"
4
4
  win.puts "have a border."
data/examples/prog04.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(8, 39, 4, 9, true, fg: Black, bg: Blue)
1
+ win = RubyText.window(8, 39, 4, 9, fg: Black, bg: Blue)
2
2
 
3
3
  win.puts "If your text is longer than " +
4
4
  "the width of the window, by default it will " +
data/examples/prog05.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(10, 70, 2, 14, true, fg: Yellow, bg: Black)
1
+ win = RubyText.window(10, 70, 2, 14, fg: Yellow, bg: Black)
2
2
 
3
3
  win.output do
4
4
  puts "Without scrolling, this is what happens when your window fills up..."
data/examples/prog06.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(10, 60, 2, 14, true, fg: Blue, bg: Black)
1
+ win = RubyText.window(10, 60, 2, 14, fg: Blue, bg: Black)
2
2
 
3
3
  win.output do
4
4
  puts "The #print and #p methods also act as you expect."
data/examples/prog07.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(10, 50, 0, 5, true, fg: Yellow, bg: Blue)
1
+ win = RubyText.window(10, 50, 0, 5, fg: Yellow, bg: Blue)
2
2
 
3
3
  win.output do
4
4
  puts "Of course, #puts and #print are unaffected \nfor other receivers."
data/examples/prog08.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(11, 50, 0, 5, true, fg: Yellow, bg: Blue)
1
+ win = RubyText.window(11, 50, 0, 5, fg: Yellow, bg: Blue)
2
2
 
3
3
  win.puts "We can use the []= method (0-based)"
4
4
  win.puts "to address individual window locations"
data/examples/prog09.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(12, 60, 2, 5, true, fg: Yellow, bg: Blue)
1
+ win = RubyText.window(12, 60, 2, 5, fg: Yellow, bg: Blue)
2
2
 
3
3
  win.puts "ABCDE Method [] can retrieve characters "
4
4
  win.puts "FGHIJ from a window."
data/examples/prog10.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(6, 30, 2, 5, true, fg: Yellow, bg: Blue)
1
+ win = RubyText.window(6, 30, 2, 5, fg: Yellow, bg: Blue)
2
2
 
3
3
  win.puts "You can write to a window..."
4
4
 
data/examples/prog11.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(6, 30, 2, 5, true, fg: Yellow, bg: Blue)
1
+ win = RubyText.window(6, 30, 2, 5, fg: Yellow, bg: Blue)
2
2
 
3
3
  win.puts "We default to cbreak mode, so that characters are "
4
4
  win.puts "accepted instantly, but control-C still works."
data/examples/prog12.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(12, 65, 1, 5, true, fg: Yellow, bg: Blue)
1
+ win = RubyText.window(12, 65, 1, 5, fg: Yellow, bg: Blue)
2
2
 
3
3
  win.output do
4
4
  puts "You can detect the size and cursor position of any window."
data/examples/prog13.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(11, 65, 0, 15, true, fg: Blue, bg: Black)
1
+ win = RubyText.window(11, 65, 0, 15, fg: Blue, bg: Black)
2
2
 
3
3
  win.puts "The #go method will move the cursor to a specific location."
4
4
  win.go 2, 5
data/examples/prog14.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(13, 65, 0, 6, true, fg: Blue, bg: White)
1
+ win = RubyText.window(13, 65, 0, 6, fg: Blue, bg: White)
2
2
 
3
3
  win.puts "The #rcprint method will print at the specified"
4
4
  win.puts "row/column, like go(r,c) followed by a print,"
data/examples/prog15.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(11, 65, 0, 6, true, fg: Blue, bg: White)
1
+ win = RubyText.window(11, 65, 0, 6, fg: Blue, bg: White)
2
2
 
3
3
  win.go 2,0
4
4
  win.puts " Method #home will home the cursor..."
data/examples/prog16.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(11, 65, 1, 6, true, fg: Blue, bg: White)
1
+ win = RubyText.window(11, 65, 1, 6, fg: Blue, bg: White)
2
2
 
3
3
  win.puts "Methods up/down/left/right can also take an integer..."
4
4
 
data/examples/prog17.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(11, 65, 1, 6, true, fg: Blue, bg: White)
1
+ win = RubyText.window(11, 65, 1, 6, fg: Blue, bg: White)
2
2
 
3
3
  win.go 2,0
4
4
  win.puts "We also have: up!, down!, left!, and right! which can"
data/examples/prog18.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(11, 65, 1, 6, true, fg: Blue, bg: White)
1
+ win = RubyText.window(11, 65, 1, 6, fg: Blue, bg: White)
2
2
 
3
3
  win.go 2,0
4
4
  win.puts "#top and #bottom are the same as #up! and #down!"
data/examples/prog19.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(15, 65, 1, 6, true, fg: Green, bg: Blue)
1
+ win = RubyText.window(15, 65, 1, 6, fg: Green, bg: Blue)
2
2
 
3
3
  win.puts "#center will print text centered on the current row"
4
4
  win.puts "and do an implicit CRLF at the end.\n "
data/examples/prog20.rb CHANGED
@@ -1,4 +1,4 @@
1
- win = RubyText.window(12, 65, 0, 6, true, fg: Green, bg: Blue)
1
+ win = RubyText.window(12, 65, 0, 6, fg: Green, bg: Blue)
2
2
 
3
3
  win.puts "This is EXPERIMENTAL."
4
4
  win.puts "Use a color symbol to change text color temporarily:\n "
data/examples/showme.rb CHANGED
@@ -18,7 +18,7 @@ def show_code(prog, upward=0)
18
18
 
19
19
  prog_top = @rmax-nlines-3 - upward.to_i
20
20
  code = RubyText.window(nlines+2, @cmax-2, prog_top, 1,
21
- true, fg: :green, bg: :black)
21
+ fg: Green, bg: Black)
22
22
  code.puts text
23
23
 
24
24
  right = STDSCR.cols - prog.length - 8
@@ -39,7 +39,7 @@ end
39
39
 
40
40
  #### Main
41
41
 
42
- RubyText.start(:cbreak, log: "/tmp/showme.log", fg: :white, bg: :black)
42
+ RubyText.start(:cbreak, log: "/tmp/showme.log", fg: White, bg: Black)
43
43
 
44
44
  @cmax = STDSCR.cols
45
45
  @rmax = STDSCR.rows
data/lib/color.rb CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  def fb2cp(fg, bg)
3
- fg ||= :blue
4
- bg ||= :white
3
+ fg ||= Blue
4
+ bg ||= White
5
5
  f2 = X.const_get("COLOR_#{fg.upcase}")
6
6
  b2 = X.const_get("COLOR_#{bg.upcase}")
7
7
  cp = $ColorPairs[[fg, bg]]
@@ -9,8 +9,7 @@ def fb2cp(fg, bg)
9
9
  end
10
10
 
11
11
  module RubyText
12
- Colors = [:black, :blue, :cyan, :green, :magenta,
13
- :red, :white, :yellow]
12
+ Colors = [Black, Blue, Cyan, Green, Magenta, Red, White, Yellow]
14
13
  $ColorPairs = {}
15
14
  num = 0
16
15
  Colors.each do |fsym|
@@ -27,7 +26,7 @@ class RubyText::Window
27
26
  def self.colors(win, fg, bg)
28
27
  cfg, cbg, cp = fb2cp(fg, bg)
29
28
  X.init_pair(cp, cfg, cbg)
30
- win.color_set(cp) # |X::A_NORMAL)
29
+ win.color_set(cp)
31
30
  end
32
31
 
33
32
  def self.colors!(win, fg, bg)
data/lib/menu.rb CHANGED
@@ -24,7 +24,7 @@ module RubyText
24
24
  high = items.size + 2
25
25
  wide = items.map(&:length).max + 4
26
26
  saveback(high, wide, r, c)
27
- win = RubyText.window(high, wide, r, c, true, fg: :white, bg: :blue)
27
+ win = RubyText.window(high, wide, r, c, fg: White, bg: Blue)
28
28
  RubyText.set(:raw)
29
29
  X.stdscr.keypad(true)
30
30
  RubyText.hide_cursor
@@ -33,7 +33,7 @@ module RubyText
33
33
  loop do
34
34
  items.each.with_index do |item, row|
35
35
  win.go row, 0
36
- color = sel == row ? :yellow : :white
36
+ color = sel == row ? Yellow : White
37
37
  win.puts color, " #{item} "
38
38
  end
39
39
  ch = getch
@@ -57,7 +57,7 @@ module RubyText
57
57
  high = rows
58
58
  wide = cols
59
59
  saveback(high, wide, r, c)
60
- menu_win = RubyText.window(high, wide, r, c, true, fg: :white, bg: :blue)
60
+ menu_win = RubyText.window(high, wide, r, c, fg: White, bg: Blue)
61
61
  win2 = win
62
62
  handler = callback
63
63
  RubyText.set(:raw)
@@ -69,7 +69,7 @@ module RubyText
69
69
  loop do
70
70
  items.each.with_index do |item, row|
71
71
  menu_win.go row, 0
72
- color = sel == row ? :yellow : :white
72
+ color = sel == row ? Yellow : White
73
73
  menu_win.puts color, " #{item} "
74
74
  end
75
75
  ch = getch
data/lib/rubytext.rb CHANGED
@@ -6,7 +6,7 @@ X = Curses # shorthand
6
6
 
7
7
  # Colors are 'global' for now
8
8
  Black, Blue, Cyan, Green, Magenta, Red, White, Yellow =
9
- :black, :blue, :cyan, :green, :magenta, :red, :white, :yellow
9
+ :black, :blue, :cyan, :green, :magenta, :red, :white, :yellow
10
10
 
11
11
  require 'version'
12
12
  require 'output' # RubyText, RubyText::Window, Kernel
data/lib/settings.rb CHANGED
@@ -6,6 +6,8 @@ module RubyText
6
6
  @flags
7
7
  end
8
8
 
9
+ # FIXME Refactor the Hal out of this.
10
+
9
11
  def self.inverse_flag(flag)
10
12
  sflag = flag.to_s
11
13
  if sflag[0] == "_"
@@ -97,7 +99,7 @@ module RubyText
97
99
  end
98
100
  end
99
101
 
100
- def self.window(high, wide, r0, c0, border=false, fg: nil, bg: nil)
102
+ def self.window(high, wide, r0, c0, border: true, fg: nil, bg: nil)
101
103
  RubyText::Window.new(high, wide, r0, c0, border, fg, bg)
102
104
  end
103
105
 
data/lib/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  module RubyText
3
- VERSION = "0.0.52"
3
+ VERSION = "0.0.53"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
data/lib/widgets.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module RubyText
2
2
  def self.ticker(row: STDSCR.rows-1, col: 0, width: STDSCR.cols,
3
- fg: :white, bg: :blue, text:, delay: 0.1)
3
+ fg: White, bg: Blue, text:, delay: 0.1)
4
4
  text = text.gsub("\n", " ") + " "
5
- win = RubyText.window(1, width, row, col, false, fg: fg, bg: bg)
5
+ win = RubyText.window(1, width, row, col, border: false, fg: fg, bg: bg)
6
6
  leader = " "*width + text
7
7
  leader = text.chars.cycle.each_cons(width)
8
8
  width.times { win.rcprint 0, 0, leader.next.join }
data/lib/window.rb CHANGED
@@ -51,7 +51,7 @@ class RubyText::Window
51
51
  @screen
52
52
  end
53
53
 
54
- def self.make(cwin, high, wide, r0, c0, border, fg: :white, bg: :black)
54
+ def self.make(cwin, high, wide, r0, c0, border, fg: White, bg: Black)
55
55
  obj = self.allocate
56
56
  obj.instance_eval do
57
57
  # debug " Inside instance_eval..."
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubytext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.52
4
+ version: 0.0.53
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton