rubytext 0.0.53 → 0.0.54
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 +4 -4
- data/README.md +82 -0
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfca6da2edf0b5606c68ff215ad0b4cfa94eed796e9174f30db8e4a452e2f46e
|
4
|
+
data.tar.gz: 742f9c6bff9adaf73632a539125c6b724d7281869b4d497617e27acacaa4ad49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4569c3d19ade57d06e46d37f30830a3e9ae5642f0217bb4213cd5d2188ab9e572ef5a515807d5884c516a70c5e0abd648fb29808c5039ecdd43ac168346d898
|
7
|
+
data.tar.gz: 612624e6134a8342d584d09ea0c79f34671cfabbd21431276965f4977de50dd0561135d6dd08831abbd21fdc09ce13a64dd0d30b8b272d0737ed628d3bc8767b
|
data/README.md
CHANGED
@@ -36,6 +36,88 @@ then use `puts`, it will write to the standard screen (called `STDSCR` in this l
|
|
36
36
|
The `getch` (get character) simply waits for keyboard input before proceeding. Without it, the
|
37
37
|
program might terminate too fast for you to see anything.
|
38
38
|
|
39
|
+
## The "slideshow"
|
40
|
+
|
41
|
+
Here are some of the programs from the `rubytext slides` set of demos. See the `examples`
|
42
|
+
directory and the `showme.rb` script.
|
43
|
+
|
44
|
+
A simple window:
|
45
|
+
```ruby
|
46
|
+
require 'rubytext`
|
47
|
+
win = RubyText.window(6, 25, 2, 34,
|
48
|
+
# 6 rows, 25 cols; upper left at 2,4
|
49
|
+
fg: Blue, bg: White) # foreground, background
|
50
|
+
|
51
|
+
win.puts "This is a window..."
|
52
|
+
```
|
53
|
+
|
54
|
+
How `output` works. This name may change.
|
55
|
+
```ruby
|
56
|
+
require 'rubytext`
|
57
|
+
win = RubyText.window(9, 36, 2, 6, fg: White, bg: Red)
|
58
|
+
|
59
|
+
win.output do
|
60
|
+
puts "Because this code uses #output,"
|
61
|
+
puts "it doesn't have to specify the"
|
62
|
+
puts "window as a receiver each time."
|
63
|
+
end
|
64
|
+
```
|
65
|
+
|
66
|
+
Windows are bordered by default.
|
67
|
+
```ruby
|
68
|
+
require 'rubytext`
|
69
|
+
win = RubyText.window(9, 35, 3, 7, border: false, fg: Black, bg: Green)
|
70
|
+
|
71
|
+
win.puts "A window doesn't have to"
|
72
|
+
win.puts "have a border."
|
73
|
+
```
|
74
|
+
|
75
|
+
Using `puts` will wrap around the window automagically.
|
76
|
+
```ruby
|
77
|
+
require 'rubytext`
|
78
|
+
win = RubyText.window(8, 39, 4, 9, fg: Black, bg: Blue)
|
79
|
+
|
80
|
+
win.puts "If your text is longer than " +
|
81
|
+
"the width of the window, by default it will " +
|
82
|
+
"wrap around."
|
83
|
+
|
84
|
+
win.puts "Scrolling is not yet supported."
|
85
|
+
```
|
86
|
+
|
87
|
+
Scrolling is not yet implemented.
|
88
|
+
```ruby
|
89
|
+
require 'rubytext`
|
90
|
+
win = RubyText.window(10, 70, 2, 14, fg: Yellow, bg: Black)
|
91
|
+
|
92
|
+
win.output do
|
93
|
+
puts "Without scrolling, this is what happens when your window fills up..."
|
94
|
+
puts "This behavior will probably change later."
|
95
|
+
sleep 1
|
96
|
+
puts "Let's print 10 more lines now:"
|
97
|
+
sleep 1
|
98
|
+
|
99
|
+
10.times {|i| puts "Printing line #{i}..."; sleep 0.2 }
|
100
|
+
end
|
101
|
+
|
102
|
+
```
|
103
|
+
|
104
|
+
You can use `print` and `p` as well as `puts`.
|
105
|
+
```ruby
|
106
|
+
require 'rubytext`
|
107
|
+
win = RubyText.window(10, 60, 2, 14, fg: Blue, bg: Black)
|
108
|
+
|
109
|
+
win.output do
|
110
|
+
puts "The #print and #p methods also act as you expect."
|
111
|
+
|
112
|
+
print "This will all "
|
113
|
+
print "go on a single "
|
114
|
+
puts "line."
|
115
|
+
|
116
|
+
puts
|
117
|
+
array = [1, 2, 3]
|
118
|
+
p array
|
119
|
+
end
|
120
|
+
```
|
39
121
|
|
40
122
|
*More later...*
|
41
123
|
|
data/lib/version.rb
CHANGED