flex_core 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flex_core.rb +107 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3beab33e8512dc6ebd1500ee262c2381845a7925
|
4
|
+
data.tar.gz: 4d9328ae1b2206d90b770ee04361b41c3f987829
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74d37ac5551022701c7f8ff191f9ae72c77ad948104cc7fb2150fae6ba3564f3f8c4010ca36c0d0573152e4260ce500b519c7e7ffbd4285ec59571096bfdb879
|
7
|
+
data.tar.gz: 44f53543d1a186015570a6c790a6a502881295904915ef9a2c41b6eff6ad44c2cb063c1c167cf285cd2dc680d65348399eb73c0841a9ccb9f54e154563866f55
|
data/lib/flex_core.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
1
3
|
class FlexCore
|
2
4
|
|
3
5
|
class << self
|
@@ -10,6 +12,85 @@ class FlexCore
|
|
10
12
|
|
11
13
|
end
|
12
14
|
|
15
|
+
module Kernel
|
16
|
+
|
17
|
+
class << self
|
18
|
+
attr_accessor :print_flag, :print_counter
|
19
|
+
end
|
20
|
+
|
21
|
+
old_puts = Kernel.instance_method(:puts)
|
22
|
+
|
23
|
+
define_method(:puts) do |thing|
|
24
|
+
|
25
|
+
if Kernel.print_flag
|
26
|
+
old_puts.bind(self).()
|
27
|
+
Kernel.print_flag = false
|
28
|
+
Kernel.print_counter = 0
|
29
|
+
end
|
30
|
+
|
31
|
+
old_puts.bind(self).(thing)
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
def vsleep (seconds)
|
36
|
+
sleep = seconds.to_i
|
37
|
+
puts
|
38
|
+
sleep.times do
|
39
|
+
sleep(1)
|
40
|
+
print '.'
|
41
|
+
end
|
42
|
+
puts
|
43
|
+
end
|
44
|
+
|
45
|
+
def boink
|
46
|
+
print "\a"
|
47
|
+
end
|
48
|
+
|
49
|
+
def blip (tone = 440)
|
50
|
+
`play -n synth 0.04 triangle #{tone}`
|
51
|
+
end
|
52
|
+
|
53
|
+
def strum (speed = 0.2)
|
54
|
+
`play -n synth sin G3 sin D4 sin A sin E5 fade h 0.2 #{speed} 0.2`
|
55
|
+
end
|
56
|
+
|
57
|
+
def sputs (string, speed = 0.005)
|
58
|
+
|
59
|
+
chars = string.chars
|
60
|
+
specials = ["\n", ',', '.']
|
61
|
+
|
62
|
+
chars.each_with_index { |char, index|
|
63
|
+
|
64
|
+
print char
|
65
|
+
|
66
|
+
if char.is_in?(specials) && chars[index + 1].is_not_in?(specials)
|
67
|
+
sleep(speed * 5)
|
68
|
+
else
|
69
|
+
sleep(speed)
|
70
|
+
end
|
71
|
+
|
72
|
+
}
|
73
|
+
puts
|
74
|
+
end
|
75
|
+
|
76
|
+
def lprint (thing, limit = 50)
|
77
|
+
print thing
|
78
|
+
|
79
|
+
Kernel.print_counter ||= 0
|
80
|
+
Kernel.print_counter += 1
|
81
|
+
|
82
|
+
puts if Kernel.print_counter == limit
|
83
|
+
|
84
|
+
Kernel.print_flag = true
|
85
|
+
end
|
86
|
+
|
87
|
+
def rputs (thing)
|
88
|
+
puts thing
|
89
|
+
thing
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
13
94
|
class Hash
|
14
95
|
|
15
96
|
def store! (key, value)
|
@@ -66,12 +147,30 @@ class NilClass
|
|
66
147
|
self
|
67
148
|
end
|
68
149
|
|
150
|
+
def strip
|
151
|
+
''
|
152
|
+
end
|
153
|
+
|
69
154
|
end
|
70
155
|
|
71
156
|
class Object
|
157
|
+
|
72
158
|
def deep_copy
|
73
159
|
Marshal.load(Marshal.dump(self))
|
74
160
|
end
|
161
|
+
|
162
|
+
def is_in? (array)
|
163
|
+
array.include?(self)
|
164
|
+
end
|
165
|
+
|
166
|
+
def not_in? (array)
|
167
|
+
array.exclude?(self)
|
168
|
+
end
|
169
|
+
|
170
|
+
def is_not_in? (array)
|
171
|
+
array.exclude?(self)
|
172
|
+
end
|
173
|
+
|
75
174
|
end
|
76
175
|
|
77
176
|
class Dummy
|
@@ -107,3 +206,11 @@ class String
|
|
107
206
|
|
108
207
|
end
|
109
208
|
|
209
|
+
class Array
|
210
|
+
|
211
|
+
def exclude? (object)
|
212
|
+
!self.include?(object)
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|
216
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flex_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eugene Lai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: To do
|
14
14
|
email: ejt.lai@gmail.com
|