wdd-ruby-ext 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/VERSION +1 -1
- data/lib/wdd-ruby-ext/utils/time_gate.rb +18 -18
- data/wdd-ruby-ext.gemspec +2 -2
- metadata +4 -4
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
@@ -31,26 +31,26 @@ module WDD
|
|
31
31
|
def initialize
|
32
32
|
@gate_time = Time.now
|
33
33
|
end
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
34
|
+
|
35
|
+
class << self
|
36
|
+
# Evaluated the passed block and returns the elapsed wall clock time.
|
37
|
+
def elapsed_time &block
|
38
|
+
start_time = Time.now
|
39
|
+
yield
|
40
|
+
Time.now - start_time
|
41
|
+
end
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
# Sleeps the specified interval. If a block is passed, it will be evaluated every +guard_interval+ seconds.
|
44
|
+
# If it evaluates to true, the sleep will be interrupted and control will be returned to the caller.
|
45
|
+
def interruptable_sleep sleep_time, guard_interval=0.5
|
46
|
+
if block_given?
|
47
|
+
while( yield && sleep_time > 0 )
|
48
|
+
sleep guard_interval
|
49
|
+
sleep_time -= guard_interval
|
50
|
+
end
|
51
|
+
else
|
52
|
+
sleep sleep_time
|
51
53
|
end
|
52
|
-
else
|
53
|
-
sleep sleep_time
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/wdd-ruby-ext.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{wdd-ruby-ext}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["shock"]
|
12
|
-
s.date = %q{2011-01-
|
12
|
+
s.date = %q{2011-01-19}
|
13
13
|
s.description = %q{Some of these are borrowed. Some are original. This gem simply provides a single place to source control them all for incorporation into other projects.}
|
14
14
|
s.email = %q{billdoughty@capitalthought.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wdd-ruby-ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- shock
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-19 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|