em-sequence 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b8a1f18206c4bcd6cae2bc119e78c320e1ff29f7
4
+ data.tar.gz: a9a4ee463262d1812c79504d802b0f6edab409e4
5
+ SHA512:
6
+ metadata.gz: c46d4fa5ae86afbde1b018cbb2210596f4648b13de96b9177fe55c20c441321c9cdbc5b43e6ab03b0fd55ec2eb7e08ce35b6fc3070e55a1b8b91184f0a818ce7
7
+ data.tar.gz: a986ef65c1bab56b05dcd75dda4ce17dea5297c6dab8dc7d74440ee329fc3bf2ff8029b78ac0a7888d3e59a7866b724786a2474278dbeff8432ea5ab7bfce8ff
data/Gemfile CHANGED
@@ -1,12 +1,12 @@
1
1
  source "http://rubygems.org"
2
2
  # Add dependencies required to use your gem here.
3
3
  # Example:
4
- gem "hash-utils", ">= 0.10.0"
5
4
  gem "eventmachine", ">= 0.12.10"
6
5
 
7
6
  # Add dependencies to develop your gem here.
8
7
  # Include everything needed to run rake, tests, features, etc.
9
8
  group :development do
10
- gem "bundler", "~> 1.0.0"
11
- gem "jeweler", "~> 1.5.2"
9
+ gem "bundler", ">= 1.0.0"
10
+ gem "jeweler", ">= 1.5.2"
11
+ gem "riot", ">= 0.12.1"
12
12
  end
data/Gemfile.lock CHANGED
@@ -1,20 +1,62 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- eventmachine (0.12.10)
5
- git (1.2.5)
6
- hash-utils (0.10.0)
7
- jeweler (1.5.2)
8
- bundler (~> 1.0.0)
4
+ addressable (2.3.8)
5
+ builder (3.2.2)
6
+ descendants_tracker (0.0.4)
7
+ thread_safe (~> 0.3, >= 0.3.1)
8
+ eventmachine (1.0.7)
9
+ faraday (0.9.1)
10
+ multipart-post (>= 1.2, < 3)
11
+ git (1.2.9.1)
12
+ github_api (0.12.3)
13
+ addressable (~> 2.3)
14
+ descendants_tracker (~> 0.0.4)
15
+ faraday (~> 0.8, < 0.10)
16
+ hashie (>= 3.3)
17
+ multi_json (>= 1.7.5, < 2.0)
18
+ nokogiri (~> 1.6.3)
19
+ oauth2
20
+ hashie (3.4.2)
21
+ highline (1.7.2)
22
+ jeweler (2.0.1)
23
+ builder
24
+ bundler (>= 1.0)
9
25
  git (>= 1.2.5)
26
+ github_api
27
+ highline (>= 1.6.15)
28
+ nokogiri (>= 1.5.10)
10
29
  rake
11
- rake (0.8.7)
30
+ rdoc
31
+ jwt (1.5.1)
32
+ mini_portile (0.6.2)
33
+ multi_json (1.11.2)
34
+ multi_xml (0.5.5)
35
+ multipart-post (2.0.0)
36
+ nokogiri (1.6.6.2)
37
+ mini_portile (~> 0.6.0)
38
+ oauth2 (1.0.0)
39
+ faraday (>= 0.8, < 0.10)
40
+ jwt (~> 1.0)
41
+ multi_json (~> 1.3)
42
+ multi_xml (~> 0.5)
43
+ rack (~> 1.2)
44
+ rack (1.6.4)
45
+ rake (10.4.2)
46
+ rdoc (4.2.0)
47
+ riot (0.12.7)
48
+ rr
49
+ rr (1.1.2)
50
+ thread_safe (0.3.5)
12
51
 
13
52
  PLATFORMS
14
53
  ruby
15
54
 
16
55
  DEPENDENCIES
17
- bundler (~> 1.0.0)
56
+ bundler (>= 1.0.0)
18
57
  eventmachine (>= 0.12.10)
19
- hash-utils (>= 0.10.0)
20
- jeweler (~> 1.5.2)
58
+ jeweler (>= 1.5.2)
59
+ riot (>= 0.12.1)
60
+
61
+ BUNDLED WITH
62
+ 1.10.5
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
1
+ Copyright (c) 2011 - 2015 Martin Poljak (martin@poljak.cz)
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -6,88 +6,88 @@ concurrency. Runs declared methods and blocks in sequence, each in one
6
6
  tick. So allows calls chaining with keeping the EventMachine multiplexing
7
7
  facility on.
8
8
 
9
- See an example. For first, define some (of sure, slightly non-sense) calculator class:
9
+ See an example. For first, let's define some (of sure, slightly
10
+ non-sense) calculator class:
10
11
 
11
- class Calculator
12
- def some_method(var, &block)
13
- block.call(1, var)
14
- end
15
-
16
- def other_method(x, y, &block)
17
- block.call(x + y)
18
- end
19
-
20
- def another_method(z, &block)
21
- block.call(z ** 2)
22
- end
12
+ ```ruby
13
+ class Calculator
14
+ def some_method(var, &block)
15
+ block.call(1, var)
16
+ end
17
+
18
+ def other_method(x, y, &block)
19
+ block.call(x + y)
20
+ end
21
+
22
+ def another_method(z, &block)
23
+ block.call(z ** 2)
23
24
  end
25
+ end
26
+ ```
24
27
 
25
28
  And then declare and run multiplexed code:
26
29
 
27
- EM::run do
28
- EM::Sequence::new(Calculator::new).declare {
30
+ ```ruby
31
+ EM::run do
32
+ EM::Sequence::new(Calculator::new).declare {
33
+
34
+ # variable declaration
35
+ variable :var, 3
36
+
37
+ # method call declaration
38
+ some_method(:var) { [:x, :y] } # | TICK 1
39
+ # V
40
+ # inline block declaration and definition
41
+ block(:x, :y) do |x, y| # | TICK 2
42
+ {:x => x + 1, :y => y + 1} # |
43
+ end # V
44
+
45
+ # some other methods
46
+ other_method(:x, :y) { :x } # V TICK 3
47
+ another_method(:x) # V TICK 4
29
48
 
30
- # variable declaration
31
- variable :var, 3
32
-
33
- # method call declaration
34
- some_method(:var) { [:x, :y] } # | TICK 1
35
- # V
36
- # inline block declaration and definition
37
- block(:x, :y) do |x, y| # | TICK 2
38
- {:x => x + 1, :y => y + 1} # |
39
- end # V
40
-
41
- # some other methods
42
- other_method(:x, :y) { :x } # V TICK 3
43
- another_method(:x) # V TICK 4
44
-
45
- }.run! do |result| # | TICK 5
46
- puts result.inspect # |
47
- end # V
48
- end
49
+ }.run! do |result| # | TICK 5
50
+ puts result.inspect # |
51
+ end # V
52
+ end
53
+ ```
49
54
 
50
55
  It will print out the number `36`. It's the same as linear
51
56
  non-multiplexed (and non-callbacked calculator):
52
57
 
53
- # variable declaration # | TICK 1
54
- calc = Calculator::new # |
55
- var = 3 # |
56
- # |
57
- # method call declaration # |
58
- x, y = calc.some_method(var) # |
59
- # |
60
- # inline block declaration and definition # |
61
- x += 1 # |
62
- y += 1 # |
63
- # |
64
- # some other methods # |
65
- x = calc.other_method(x, y) # |
66
- result = calc.another_method(x) # |
67
- # |
68
- puts result.inspect # V
69
-
58
+ ```ruby
59
+ # variable declaration # | TICK 1
60
+ calc = Calculator::new # |
61
+ var = 3 # |
62
+ # |
63
+ # method call declaration # |
64
+ x, y = calc.some_method(var) # |
65
+ # |
66
+ # inline block declaration and definition # |
67
+ x += 1 # |
68
+ y += 1 # |
69
+ # |
70
+ # some other methods # |
71
+ x = calc.other_method(x, y) # |
72
+ result = calc.another_method(x) # |
73
+ # |
74
+ puts result.inspect # V
75
+ ```
76
+
70
77
  If you don't expect any result, you can simply call:
71
- EM::Sequence::run(Calculator::new) do
72
- # some declaration, see above
73
- end
74
-
75
- Contributing
76
- ------------
77
78
 
78
- 1. Fork it.
79
- 2. Create a branch (`git checkout -b 20101220-my-change`).
80
- 3. Commit your changes (`git commit -am "Added something"`).
81
- 4. Push to the branch (`git push origin 20101220-my-change`).
82
- 5. Create an [Issue][2] with a link to your branch.
83
- 6. Enjoy a refreshing Diet Coke and wait.
79
+ ```ruby
80
+ EM::Sequence::run(Calculator::new) do
81
+ # some declaration, see above
82
+ end
83
+ ```
84
84
 
85
85
  Copyright
86
86
  ---------
87
87
 
88
- Copyright &copy; 2011 [Martin Kozák][3]. See `LICENSE.txt` for
88
+ Copyright &copy; 2011 &ndash; 2015 [Martin Poljak][3]. See `LICENSE.txt` for
89
89
  further details.
90
90
 
91
91
  [2]: http://github.com/martinkozak/em-sequence/issues
92
- [3]: http://www.martinkozak.net/
92
+ [3]: http://www.martinpoljak.net/
93
93
  [4]: http://rubyeventmachine.com/
data/Rakefile CHANGED
@@ -17,21 +17,11 @@ Jeweler::Tasks.new do |gem|
17
17
  gem.homepage = "https://github.com/martinkozak/em-sequence"
18
18
  gem.license = "MIT"
19
19
  gem.summary = "Third approach to EventMachine lightweight concurrency. Runs declared methods and blocks in sequence, each in one tick. So allows calls chaining with keeping the EventMachine multiplexing facility on."
20
- gem.email = "martinkozak@martinkozak.net"
21
- gem.authors = ["Martin Kozák"]
20
+ gem.email = "martin@poljak.cz"
21
+ gem.authors = ["Martin Poljak"]
22
22
  # Include your dependencies below. Runtime dependencies are required when using your gem,
23
23
  # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
24
  # gem.add_runtime_dependency 'jabber4r', '> 0.1'
25
25
  # gem.add_development_dependency 'rspec', '> 1.2.3'
26
26
  end
27
27
  Jeweler::RubygemsDotOrgTasks.new
28
-
29
- require 'rake/rdoctask'
30
- Rake::RDocTask.new do |rdoc|
31
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
32
-
33
- rdoc.rdoc_dir = 'rdoc'
34
- rdoc.title = "qrpc #{version}"
35
- rdoc.rdoc_files.include('README*')
36
- rdoc.rdoc_files.include('lib/**/*.rb')
37
- end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/em-sequence.gemspec CHANGED
@@ -2,15 +2,17 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: em-sequence 0.1.2 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
- s.name = %q{em-sequence}
8
- s.version = "0.1.1"
8
+ s.name = "em-sequence"
9
+ s.version = "0.1.2"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Martin Kozák"]
12
- s.date = %q{2011-02-27}
13
- s.email = %q{martinkozak@martinkozak.net}
12
+ s.require_paths = ["lib"]
13
+ s.authors = ["Martin Poljak"]
14
+ s.date = "2015-07-19"
15
+ s.email = "martin@poljak.cz"
14
16
  s.extra_rdoc_files = [
15
17
  "LICENSE.txt",
16
18
  "README.md"
@@ -29,31 +31,30 @@ Gem::Specification.new do |s|
29
31
  "lib/em-sequence/method.rb",
30
32
  "test.rb"
31
33
  ]
32
- s.homepage = %q{https://github.com/martinkozak/em-sequence}
34
+ s.homepage = "https://github.com/martinkozak/em-sequence"
33
35
  s.licenses = ["MIT"]
34
- s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.5.3}
36
- s.summary = %q{Third approach to EventMachine lightweight concurrency. Runs declared methods and blocks in sequence, each in one tick. So allows calls chaining with keeping the EventMachine multiplexing facility on.}
36
+ s.rubygems_version = "2.4.5"
37
+ s.summary = "Third approach to EventMachine lightweight concurrency. Runs declared methods and blocks in sequence, each in one tick. So allows calls chaining with keeping the EventMachine multiplexing facility on."
37
38
 
38
39
  if s.respond_to? :specification_version then
39
- s.specification_version = 3
40
+ s.specification_version = 4
40
41
 
41
42
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
- s.add_runtime_dependency(%q<hash-utils>, [">= 0.10.0"])
43
43
  s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.10"])
44
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
45
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
44
+ s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
45
+ s.add_development_dependency(%q<jeweler>, [">= 1.5.2"])
46
+ s.add_development_dependency(%q<riot>, [">= 0.12.1"])
46
47
  else
47
- s.add_dependency(%q<hash-utils>, [">= 0.10.0"])
48
48
  s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
49
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
50
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
49
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
50
+ s.add_dependency(%q<jeweler>, [">= 1.5.2"])
51
+ s.add_dependency(%q<riot>, [">= 0.12.1"])
51
52
  end
52
53
  else
53
- s.add_dependency(%q<hash-utils>, [">= 0.10.0"])
54
54
  s.add_dependency(%q<eventmachine>, [">= 0.12.10"])
55
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
56
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
55
+ s.add_dependency(%q<bundler>, [">= 1.0.0"])
56
+ s.add_dependency(%q<jeweler>, [">= 1.5.2"])
57
+ s.add_dependency(%q<riot>, [">= 0.12.1"])
57
58
  end
58
59
  end
59
60
 
data/lib/em-sequence.rb CHANGED
@@ -2,7 +2,6 @@
2
2
  # (c) 2011 Martin Kozák
3
3
 
4
4
  require 'eventmachine'
5
- require 'hash-utils/hash'
6
5
  require 'em-sequence/block'
7
6
  require 'em-sequence/method'
8
7
 
@@ -78,7 +78,7 @@ module EM
78
78
  def call(vars, &block)
79
79
  call_args = vars.values_at(*@args)
80
80
  @target.send(@name, *call_args) do |*returns|
81
- result = Hash::combine(self.meta, returns)
81
+ result = __combine(self.meta, returns)
82
82
  block.call(result, returns.first)
83
83
  end
84
84
  end
@@ -100,7 +100,19 @@ module EM
100
100
 
101
101
  return @meta
102
102
  end
103
+
104
+
105
+ private
106
+
107
+ def __combine(keys, values)
108
+ result = { }
109
+ keys.each_index do |i|
110
+ result[keys[i]] = values[i]
111
+ end
112
+
113
+ return result
114
+ end
115
+
103
116
  end
104
117
  end
105
118
  end
106
-
data/test.rb CHANGED
@@ -5,7 +5,6 @@
5
5
  $:.push("./lib")
6
6
 
7
7
  require 'eventmachine'
8
- require 'hash-utils/hash'
9
8
  require 'em-sequence'
10
9
  require 'riot'
11
10
 
metadata CHANGED
@@ -1,73 +1,80 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: em-sequence
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
6
5
  platform: ruby
7
- authors:
8
- - "Martin Koz\xC3\xA1k"
6
+ authors:
7
+ - Martin Poljak
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2011-02-27 00:00:00 +01:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: hash-utils
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 0.10.0
24
- type: :runtime
25
- prerelease: false
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
11
+ date: 2015-07-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
28
14
  name: eventmachine
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
32
17
  - - ">="
33
- - !ruby/object:Gem::Version
18
+ - !ruby/object:Gem::Version
34
19
  version: 0.12.10
35
20
  type: :runtime
36
21
  prerelease: false
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.12.10
27
+ - !ruby/object:Gem::Dependency
39
28
  name: bundler
40
- requirement: &id003 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
45
33
  version: 1.0.0
46
34
  type: :development
47
35
  prerelease: false
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
41
+ - !ruby/object:Gem::Dependency
50
42
  name: jeweler
51
- requirement: &id004 !ruby/object:Gem::Requirement
52
- none: false
53
- requirements:
54
- - - ~>
55
- - !ruby/object:Gem::Version
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
56
47
  version: 1.5.2
57
48
  type: :development
58
49
  prerelease: false
59
- version_requirements: *id004
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.5.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: riot
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.12.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.12.1
60
69
  description:
61
- email: martinkozak@martinkozak.net
70
+ email: martin@poljak.cz
62
71
  executables: []
63
-
64
72
  extensions: []
65
-
66
- extra_rdoc_files:
73
+ extra_rdoc_files:
67
74
  - LICENSE.txt
68
75
  - README.md
69
- files:
70
- - .document
76
+ files:
77
+ - ".document"
71
78
  - Gemfile
72
79
  - Gemfile.lock
73
80
  - LICENSE.txt
@@ -79,36 +86,30 @@ files:
79
86
  - lib/em-sequence/block.rb
80
87
  - lib/em-sequence/method.rb
81
88
  - test.rb
82
- has_rdoc: true
83
89
  homepage: https://github.com/martinkozak/em-sequence
84
- licenses:
90
+ licenses:
85
91
  - MIT
92
+ metadata: {}
86
93
  post_install_message:
87
94
  rdoc_options: []
88
-
89
- require_paths:
95
+ require_paths:
90
96
  - lib
91
- required_ruby_version: !ruby/object:Gem::Requirement
92
- none: false
93
- requirements:
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
94
99
  - - ">="
95
- - !ruby/object:Gem::Version
96
- hash: -4534630292098080995
97
- segments:
98
- - 0
99
- version: "0"
100
- required_rubygems_version: !ruby/object:Gem::Requirement
101
- none: false
102
- requirements:
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
103
104
  - - ">="
104
- - !ruby/object:Gem::Version
105
- version: "0"
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
106
107
  requirements: []
107
-
108
108
  rubyforge_project:
109
- rubygems_version: 1.5.3
109
+ rubygems_version: 2.4.5
110
110
  signing_key:
111
- specification_version: 3
112
- summary: Third approach to EventMachine lightweight concurrency. Runs declared methods and blocks in sequence, each in one tick. So allows calls chaining with keeping the EventMachine multiplexing facility on.
111
+ specification_version: 4
112
+ summary: Third approach to EventMachine lightweight concurrency. Runs declared methods
113
+ and blocks in sequence, each in one tick. So allows calls chaining with keeping
114
+ the EventMachine multiplexing facility on.
113
115
  test_files: []
114
-