service 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -0
- data/VERSION +1 -1
- data/lib/service.rb +7 -0
- data/service.gemspec +3 -3
- metadata +3 -4
- data/Gemfile.lock +0 -44
data/README.md
CHANGED
@@ -46,6 +46,12 @@ end
|
|
46
46
|
|
47
47
|
### Running
|
48
48
|
|
49
|
+
Service gives simply allows you to run your code that is within the `execute` method in four different ways:
|
50
|
+
once (`execute`), once in a new Thread (`execute!`), in a loop (`start`/`run`), or in a loop within a
|
51
|
+
new Thread (`start!`/`run!`)
|
52
|
+
|
53
|
+
***
|
54
|
+
|
49
55
|
Use the `start`/`run` instance method to call the `execute` instance method in a loop.
|
50
56
|
|
51
57
|
```ruby
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
data/lib/service.rb
CHANGED
@@ -35,6 +35,13 @@ class Service
|
|
35
35
|
raise NotImplementedError
|
36
36
|
end
|
37
37
|
|
38
|
+
# Call the {#execute} method within a new Thread.
|
39
|
+
#
|
40
|
+
# @return [Thread]
|
41
|
+
def execute!
|
42
|
+
Thread.new { execute }
|
43
|
+
end
|
44
|
+
|
38
45
|
# Stop the run loop.
|
39
46
|
def stop
|
40
47
|
@_service_state = :stopped
|
data/service.gemspec
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "service"
|
5
|
-
s.version = "1.0.
|
5
|
+
s.version = "1.0.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Ryan Scott Lewis"]
|
9
|
-
s.date = "2012-12-
|
9
|
+
s.date = "2012-12-16"
|
10
10
|
s.description = "Service encapsulates an object which executes a bit of code in a loop that can be started or stopped and query whether it is running or not."
|
11
11
|
s.email = "ryan@rynet.us"
|
12
|
-
s.files = ["Gemfile", "
|
12
|
+
s.files = ["Gemfile", "LICENSE", "README.md", "Rakefile", "VERSION", "lib/service.rb", "service.gemspec"]
|
13
13
|
s.homepage = "http://github.com/RyanScottLewis/service"
|
14
14
|
s.require_paths = ["lib"]
|
15
15
|
s.rubygems_version = "1.8.24"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: version
|
@@ -115,7 +115,6 @@ extensions: []
|
|
115
115
|
extra_rdoc_files: []
|
116
116
|
files:
|
117
117
|
- Gemfile
|
118
|
-
- Gemfile.lock
|
119
118
|
- LICENSE
|
120
119
|
- README.md
|
121
120
|
- Rakefile
|
@@ -136,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
135
|
version: '0'
|
137
136
|
segments:
|
138
137
|
- 0
|
139
|
-
hash:
|
138
|
+
hash: 900928583881142489
|
140
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
140
|
none: false
|
142
141
|
requirements:
|
data/Gemfile.lock
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
service (1.0.0)
|
5
|
-
version (~> 1.0)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: http://rubygems.org/
|
9
|
-
specs:
|
10
|
-
coderay (1.0.8)
|
11
|
-
github-markup (0.7.4)
|
12
|
-
guard (1.5.4)
|
13
|
-
listen (>= 0.4.2)
|
14
|
-
lumberjack (>= 1.0.2)
|
15
|
-
pry (>= 0.9.10)
|
16
|
-
thor (>= 0.14.6)
|
17
|
-
guard-yard (2.0.1)
|
18
|
-
guard (>= 1.1.0)
|
19
|
-
yard (>= 0.7.0)
|
20
|
-
listen (0.6.0)
|
21
|
-
lumberjack (1.0.2)
|
22
|
-
method_source (0.8.1)
|
23
|
-
pry (0.9.10)
|
24
|
-
coderay (~> 1.0.5)
|
25
|
-
method_source (~> 0.8)
|
26
|
-
slop (~> 3.3.1)
|
27
|
-
rake (10.0.3)
|
28
|
-
rb-fsevent (0.9.2)
|
29
|
-
redcarpet (2.2.2)
|
30
|
-
slop (3.3.3)
|
31
|
-
thor (0.16.0)
|
32
|
-
version (1.0.0)
|
33
|
-
yard (0.8.3)
|
34
|
-
|
35
|
-
PLATFORMS
|
36
|
-
ruby
|
37
|
-
|
38
|
-
DEPENDENCIES
|
39
|
-
github-markup (~> 0.7)
|
40
|
-
guard-yard (~> 2.0)
|
41
|
-
rake (~> 10.0)
|
42
|
-
rb-fsevent (~> 0.9)
|
43
|
-
redcarpet (~> 2.2.2)
|
44
|
-
service!
|