finite_machine 0.12.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -1
  3. data/README.md +1 -1
  4. data/lib/finite_machine.rb +3 -1
  5. data/lib/finite_machine/choice_merger.rb +2 -2
  6. data/lib/finite_machine/dsl.rb +4 -4
  7. data/lib/finite_machine/message_queue.rb +0 -1
  8. data/lib/finite_machine/state_machine.rb +3 -3
  9. data/lib/finite_machine/two_phase_lock.rb +6 -6
  10. data/lib/finite_machine/version.rb +1 -1
  11. metadata +20 -146
  12. data/Rakefile +0 -12
  13. data/benchmarks/memory_profile.rb +0 -11
  14. data/benchmarks/memory_usage.rb +0 -28
  15. data/examples/atm.rb +0 -45
  16. data/examples/bug_system.rb +0 -145
  17. data/finite_machine.gemspec +0 -30
  18. data/spec/integration/system_spec.rb +0 -93
  19. data/spec/performance/benchmark_spec.rb +0 -54
  20. data/spec/spec_helper.rb +0 -34
  21. data/spec/unit/alias_target_spec.rb +0 -89
  22. data/spec/unit/async_callbacks_spec.rb +0 -28
  23. data/spec/unit/auto_methods_spec.rb +0 -44
  24. data/spec/unit/callable/call_spec.rb +0 -111
  25. data/spec/unit/callbacks_spec.rb +0 -851
  26. data/spec/unit/can_spec.rb +0 -88
  27. data/spec/unit/cancel_callbacks_spec.rb +0 -46
  28. data/spec/unit/choice_spec.rb +0 -295
  29. data/spec/unit/define_spec.rb +0 -55
  30. data/spec/unit/definition_spec.rb +0 -98
  31. data/spec/unit/event_names_spec.rb +0 -15
  32. data/spec/unit/events_map/add_spec.rb +0 -23
  33. data/spec/unit/events_map/choice_transition_spec.rb +0 -25
  34. data/spec/unit/events_map/clear_spec.rb +0 -13
  35. data/spec/unit/events_map/events_spec.rb +0 -16
  36. data/spec/unit/events_map/inspect_spec.rb +0 -22
  37. data/spec/unit/events_map/match_transition_spec.rb +0 -35
  38. data/spec/unit/events_map/move_to_spec.rb +0 -45
  39. data/spec/unit/events_map/states_for_spec.rb +0 -17
  40. data/spec/unit/events_spec.rb +0 -390
  41. data/spec/unit/handlers_spec.rb +0 -120
  42. data/spec/unit/hook_event/any_state_or_event_spec.rb +0 -13
  43. data/spec/unit/hook_event/build_spec.rb +0 -13
  44. data/spec/unit/hook_event/eql_spec.rb +0 -34
  45. data/spec/unit/hook_event/initialize_spec.rb +0 -23
  46. data/spec/unit/hook_event/notify_spec.rb +0 -12
  47. data/spec/unit/hooks/clear_spec.rb +0 -16
  48. data/spec/unit/hooks/find_spec.rb +0 -19
  49. data/spec/unit/hooks/inspect_spec.rb +0 -25
  50. data/spec/unit/hooks/register_spec.rb +0 -17
  51. data/spec/unit/if_unless_spec.rb +0 -314
  52. data/spec/unit/initial_spec.rb +0 -190
  53. data/spec/unit/inspect_spec.rb +0 -22
  54. data/spec/unit/is_spec.rb +0 -49
  55. data/spec/unit/log_transitions_spec.rb +0 -24
  56. data/spec/unit/logger_spec.rb +0 -36
  57. data/spec/unit/message_queue_spec.rb +0 -62
  58. data/spec/unit/new_spec.rb +0 -50
  59. data/spec/unit/respond_to_spec.rb +0 -34
  60. data/spec/unit/state_parser/parse_spec.rb +0 -56
  61. data/spec/unit/states_spec.rb +0 -28
  62. data/spec/unit/subscribers_spec.rb +0 -40
  63. data/spec/unit/target_spec.rb +0 -225
  64. data/spec/unit/terminated_spec.rb +0 -85
  65. data/spec/unit/transition/check_conditions_spec.rb +0 -55
  66. data/spec/unit/transition/inspect_spec.rb +0 -25
  67. data/spec/unit/transition/matches_spec.rb +0 -21
  68. data/spec/unit/transition/states_spec.rb +0 -29
  69. data/spec/unit/transition/to_state_spec.rb +0 -19
  70. data/spec/unit/trigger_spec.rb +0 -18
  71. data/spec/unit/undefined_transition/eql_spec.rb +0 -15
  72. data/tasks/console.rake +0 -11
  73. data/tasks/coverage.rake +0 -11
  74. data/tasks/spec.rake +0 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0927d8bb3748c70aaf7c257b64baad97fecd95f609bcfe916d5f6f017bd9483c'
4
- data.tar.gz: b571c8bbec3efbe87c92b3d6b789a416159980cf3bf61605baef8dbb95d1aad0
3
+ metadata.gz: 15958842bd437354dba874d9b4a50ade99a2a41f4bc12353ccfd8154e391a367
4
+ data.tar.gz: 66f77251b336d802430769a83e635b4b52d689ac202d45a52b9aaec8b7fa8ff2
5
5
  SHA512:
6
- metadata.gz: c7fc9e56117dd2c0f47bd58fcda2f83517feea908382160bc402638742f54b2f6541f3cdef812995f7f44c64a9d3d9852e70e4aff3a8fdaf5cf0109bfbcf7883
7
- data.tar.gz: 05cfeb53284406a2ddb4815f11bd349b6ded5bfaa2d25b2897ed51a3913d89ed36f58e9f108f59fc5098f14131860c2e0d1d8d37735fc6ff76e2fa17cb9982a6
6
+ metadata.gz: 2e53a7002f0f60cbf2d68ccf2b3eae07674fafd4cfb831837f52e20589696d0f4e6476d83a1565b1eb615acf0e2cec7c614001c64f5b95b0ed9aa9ad677d40b3
7
+ data.tar.gz: d757f96ae40c372b720de43d3fd5db175e30b09d78fd3eb8b48042db5aafd1d14c3472e06f61ce9170f7f33fdc314674e6f0abb9d5b196759dec1ecec478563a
@@ -1,12 +1,26 @@
1
1
  # Change Log
2
2
 
3
+ ## [v0.13.0] - 2020-05-13
4
+
5
+ ### Added
6
+ * Add sync as a dependency
7
+ * Add metadata to gemspec
8
+
9
+ ### Changed
10
+ * Change StateMachine#final_state to #terminal_states by Brad Gessler(@bradgessler)
11
+ * Change to remove artefacts like tests & tasks from gemspec
12
+
13
+ ### Fixed
14
+ * Fix Ruby 2.7 keyword arguments warnings
15
+ * Fix MessageQueue deadlock by Pavel Rosický(@ahorek)
16
+
3
17
  ## [v0.12.1] - 2019-07-12
4
18
 
5
19
  ### Changed
6
20
  * Change to relax dev dependencies versions
7
21
 
8
22
  ### Fixed
9
- # Fix FiniteMachine.new to stop coercing object target that responds to to_hash into options
23
+ * Fix FiniteMachine.new to stop coercing object target that responds to to_hash into options
10
24
 
11
25
  ## [v0.12.0] - 2018-11-11
12
26
 
@@ -291,6 +305,8 @@
291
305
 
292
306
  * Initial release
293
307
 
308
+ [v0.13.0]: https://github.com/peter-murach/finite_machine/compare/v0.12.1...v0.13.0
309
+ [v0.12.1]: https://github.com/peter-murach/finite_machine/compare/v0.12.0...v0.12.1
294
310
  [v0.12.0]: https://github.com/peter-murach/finite_machine/compare/v0.11.3...v0.12.0
295
311
  [v0.11.3]: https://github.com/peter-murach/finite_machine/compare/v0.11.2...v0.11.3
296
312
  [v0.11.2]: https://github.com/peter-murach/finite_machine/compare/v0.11.1...v0.11.2
data/README.md CHANGED
@@ -200,7 +200,7 @@ TrafficLights = FiniteMachine.define do
200
200
  event :stop, :yellow => :red
201
201
  event :ready, :red => :yellow
202
202
  event :go, :yellow => :green
203
- end)
203
+ end
204
204
  ```
205
205
 
206
206
  Then you can create however many instance of above class:
@@ -47,7 +47,7 @@ module FiniteMachine
47
47
  # Raised when argument is already defined
48
48
  AlreadyDefinedError = Class.new(::ArgumentError)
49
49
 
50
- class << self
50
+ module ClassMethods
51
51
  attr_accessor :logger
52
52
 
53
53
  # Initialize an instance of finite machine
@@ -78,6 +78,8 @@ module FiniteMachine
78
78
  Class.new(Definition, &block)
79
79
  end
80
80
  end
81
+
82
+ extend ClassMethods
81
83
  end # FiniteMachine
82
84
 
83
85
  FiniteMachine.logger = Logger.new(STDERR)
@@ -13,7 +13,7 @@ module FiniteMachine
13
13
  # the transitions and attributes
14
14
  #
15
15
  # @api private
16
- def initialize(machine, name, **transitions)
16
+ def initialize(machine, name, transitions = {})
17
17
  @machine = machine
18
18
  @name = name
19
19
  @transitions = transitions
@@ -34,7 +34,7 @@ module FiniteMachine
34
34
  # @return [FiniteMachine::Transition]
35
35
  #
36
36
  # @api public
37
- def choice(to, **conditions)
37
+ def choice(to, conditions = {})
38
38
  transition_builder = TransitionBuilder.new(@machine, @name,
39
39
  @transitions.merge(conditions))
40
40
  transition_builder.call(@transitions[:from] => to)
@@ -10,7 +10,7 @@ module FiniteMachine
10
10
  # Initialize a generic DSL
11
11
  #
12
12
  # @api public
13
- def initialize(machine, **attrs)
13
+ def initialize(machine, attrs)
14
14
  @machine = machine
15
15
  @attrs = attrs
16
16
  end
@@ -53,7 +53,7 @@ module FiniteMachine
53
53
  # Initialize top level DSL
54
54
  #
55
55
  # @api public
56
- def initialize(machine, **attrs)
56
+ def initialize(machine, attrs)
57
57
  super(machine, attrs)
58
58
 
59
59
  @machine.state = FiniteMachine::DEFAULT_STATE
@@ -96,7 +96,7 @@ module FiniteMachine
96
96
  # @return [StateMachine]
97
97
  #
98
98
  # @api public
99
- def initial(value, **options)
99
+ def initial(value, options = {})
100
100
  state = (value && !value.is_a?(Hash)) ? value : raise_missing_state
101
101
  name, @defer_initial, @silent_initial = *parse_initial(options)
102
102
  @initial_event = name
@@ -122,7 +122,7 @@ module FiniteMachine
122
122
  #
123
123
  # @api public
124
124
  def terminal(*values)
125
- self.final_state = values
125
+ self.terminal_states = values
126
126
  end
127
127
 
128
128
  # Create event and associate transition
@@ -180,7 +180,6 @@ module FiniteMachine
180
180
  until @dead
181
181
  @mutex.synchronize do
182
182
  while @queue.empty?
183
- break if @dead
184
183
  @not_empty.wait(@mutex)
185
184
  end
186
185
  event = @queue.pop
@@ -28,8 +28,8 @@ module FiniteMachine
28
28
  # Initial state, defaults to :none
29
29
  attr_threadsafe :initial_state
30
30
 
31
- # Final state, defaults to :none
32
- attr_threadsafe :final_state
31
+ # Final state, defaults to nil
32
+ attr_threadsafe :terminal_states
33
33
 
34
34
  # The prefix used to name events.
35
35
  attr_threadsafe :namespace
@@ -226,7 +226,7 @@ module FiniteMachine
226
226
  #
227
227
  # @api public
228
228
  def terminated?
229
- is?(final_state)
229
+ is?(terminal_states)
230
230
  end
231
231
 
232
232
  # Restore this machine to a known state
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'sync'
3
+ require "sync"
4
4
 
5
5
  module FiniteMachine
6
6
  # Mixin to provide lock to a {Threadable}
@@ -12,9 +12,10 @@ module FiniteMachine
12
12
  # @return [Sync]
13
13
  #
14
14
  # @api private
15
- def sync
16
- @sync = Sync.new
15
+ def lock
16
+ @lock = Sync.new
17
17
  end
18
+ module_function :lock
18
19
 
19
20
  # Synchronize given block of code
20
21
  #
@@ -25,9 +26,8 @@ module FiniteMachine
25
26
  #
26
27
  # @api private
27
28
  def synchronize(mode, &block)
28
- sync.synchronize(mode, &block)
29
+ lock.synchronize(mode, &block)
29
30
  end
30
-
31
- module_function :sync, :synchronize
31
+ module_function :synchronize
32
32
  end # TwoPhaseLock
33
33
  end # FiniteMachine
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FiniteMachine
4
- VERSION = "0.12.1"
4
+ VERSION = "0.13.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finite_machine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-12 00:00:00.000000000 Z
11
+ date: 2020-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -25,47 +25,33 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: bundler
28
+ name: sync
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.5'
34
- type: :development
33
+ version: '0.5'
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.5'
40
+ version: '0.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '3.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.1'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec-benchmark
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 0.4.0
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 0.4.0
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rake
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -84,7 +70,7 @@ description: A minimal finite state machine with a straightforward syntax. You c
84
70
  quickly model states, add callbacks and use object-oriented techniques to integrate
85
71
  with ORMs.
86
72
  email:
87
- - me@piotrmurach.com
73
+ - piotr@piotrmurach.com
88
74
  executables: []
89
75
  extensions: []
90
76
  extra_rdoc_files: []
@@ -92,12 +78,6 @@ files:
92
78
  - CHANGELOG.md
93
79
  - LICENSE.txt
94
80
  - README.md
95
- - Rakefile
96
- - benchmarks/memory_profile.rb
97
- - benchmarks/memory_usage.rb
98
- - examples/atm.rb
99
- - examples/bug_system.rb
100
- - finite_machine.gemspec
101
81
  - lib/finite_machine.rb
102
82
  - lib/finite_machine/async_call.rb
103
83
  - lib/finite_machine/callable.rb
@@ -127,67 +107,15 @@ files:
127
107
  - lib/finite_machine/two_phase_lock.rb
128
108
  - lib/finite_machine/undefined_transition.rb
129
109
  - lib/finite_machine/version.rb
130
- - spec/integration/system_spec.rb
131
- - spec/performance/benchmark_spec.rb
132
- - spec/spec_helper.rb
133
- - spec/unit/alias_target_spec.rb
134
- - spec/unit/async_callbacks_spec.rb
135
- - spec/unit/auto_methods_spec.rb
136
- - spec/unit/callable/call_spec.rb
137
- - spec/unit/callbacks_spec.rb
138
- - spec/unit/can_spec.rb
139
- - spec/unit/cancel_callbacks_spec.rb
140
- - spec/unit/choice_spec.rb
141
- - spec/unit/define_spec.rb
142
- - spec/unit/definition_spec.rb
143
- - spec/unit/event_names_spec.rb
144
- - spec/unit/events_map/add_spec.rb
145
- - spec/unit/events_map/choice_transition_spec.rb
146
- - spec/unit/events_map/clear_spec.rb
147
- - spec/unit/events_map/events_spec.rb
148
- - spec/unit/events_map/inspect_spec.rb
149
- - spec/unit/events_map/match_transition_spec.rb
150
- - spec/unit/events_map/move_to_spec.rb
151
- - spec/unit/events_map/states_for_spec.rb
152
- - spec/unit/events_spec.rb
153
- - spec/unit/handlers_spec.rb
154
- - spec/unit/hook_event/any_state_or_event_spec.rb
155
- - spec/unit/hook_event/build_spec.rb
156
- - spec/unit/hook_event/eql_spec.rb
157
- - spec/unit/hook_event/initialize_spec.rb
158
- - spec/unit/hook_event/notify_spec.rb
159
- - spec/unit/hooks/clear_spec.rb
160
- - spec/unit/hooks/find_spec.rb
161
- - spec/unit/hooks/inspect_spec.rb
162
- - spec/unit/hooks/register_spec.rb
163
- - spec/unit/if_unless_spec.rb
164
- - spec/unit/initial_spec.rb
165
- - spec/unit/inspect_spec.rb
166
- - spec/unit/is_spec.rb
167
- - spec/unit/log_transitions_spec.rb
168
- - spec/unit/logger_spec.rb
169
- - spec/unit/message_queue_spec.rb
170
- - spec/unit/new_spec.rb
171
- - spec/unit/respond_to_spec.rb
172
- - spec/unit/state_parser/parse_spec.rb
173
- - spec/unit/states_spec.rb
174
- - spec/unit/subscribers_spec.rb
175
- - spec/unit/target_spec.rb
176
- - spec/unit/terminated_spec.rb
177
- - spec/unit/transition/check_conditions_spec.rb
178
- - spec/unit/transition/inspect_spec.rb
179
- - spec/unit/transition/matches_spec.rb
180
- - spec/unit/transition/states_spec.rb
181
- - spec/unit/transition/to_state_spec.rb
182
- - spec/unit/trigger_spec.rb
183
- - spec/unit/undefined_transition/eql_spec.rb
184
- - tasks/console.rake
185
- - tasks/coverage.rake
186
- - tasks/spec.rake
187
- homepage: http://piotrmurach.github.io/finite_machine/
110
+ homepage: https://piotrmurach.github.io/finite_machine/
188
111
  licenses:
189
112
  - MIT
190
- metadata: {}
113
+ metadata:
114
+ allowed_push_host: https://rubygems.org
115
+ changelog_uri: https://github.com/piotrmurach/finite_machine/blob/master/CHANGELOG.md
116
+ documentation_uri: https://www.rubydoc.info/gems/finite_machine
117
+ homepage_uri: https://piotrmurach.github.io/finite_machine/
118
+ source_code_uri: https://github.com/piotrmurach/finite_machine
191
119
  post_install_message:
192
120
  rdoc_options: []
193
121
  require_paths:
@@ -203,62 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
203
131
  - !ruby/object:Gem::Version
204
132
  version: '0'
205
133
  requirements: []
206
- rubygems_version: 3.0.3
134
+ rubygems_version: 3.1.2
207
135
  signing_key:
208
136
  specification_version: 4
209
137
  summary: A minimal finite state machine with a straightforward syntax.
210
- test_files:
211
- - spec/integration/system_spec.rb
212
- - spec/performance/benchmark_spec.rb
213
- - spec/spec_helper.rb
214
- - spec/unit/alias_target_spec.rb
215
- - spec/unit/async_callbacks_spec.rb
216
- - spec/unit/auto_methods_spec.rb
217
- - spec/unit/callable/call_spec.rb
218
- - spec/unit/callbacks_spec.rb
219
- - spec/unit/can_spec.rb
220
- - spec/unit/cancel_callbacks_spec.rb
221
- - spec/unit/choice_spec.rb
222
- - spec/unit/define_spec.rb
223
- - spec/unit/definition_spec.rb
224
- - spec/unit/event_names_spec.rb
225
- - spec/unit/events_map/add_spec.rb
226
- - spec/unit/events_map/choice_transition_spec.rb
227
- - spec/unit/events_map/clear_spec.rb
228
- - spec/unit/events_map/events_spec.rb
229
- - spec/unit/events_map/inspect_spec.rb
230
- - spec/unit/events_map/match_transition_spec.rb
231
- - spec/unit/events_map/move_to_spec.rb
232
- - spec/unit/events_map/states_for_spec.rb
233
- - spec/unit/events_spec.rb
234
- - spec/unit/handlers_spec.rb
235
- - spec/unit/hook_event/any_state_or_event_spec.rb
236
- - spec/unit/hook_event/build_spec.rb
237
- - spec/unit/hook_event/eql_spec.rb
238
- - spec/unit/hook_event/initialize_spec.rb
239
- - spec/unit/hook_event/notify_spec.rb
240
- - spec/unit/hooks/clear_spec.rb
241
- - spec/unit/hooks/find_spec.rb
242
- - spec/unit/hooks/inspect_spec.rb
243
- - spec/unit/hooks/register_spec.rb
244
- - spec/unit/if_unless_spec.rb
245
- - spec/unit/initial_spec.rb
246
- - spec/unit/inspect_spec.rb
247
- - spec/unit/is_spec.rb
248
- - spec/unit/log_transitions_spec.rb
249
- - spec/unit/logger_spec.rb
250
- - spec/unit/message_queue_spec.rb
251
- - spec/unit/new_spec.rb
252
- - spec/unit/respond_to_spec.rb
253
- - spec/unit/state_parser/parse_spec.rb
254
- - spec/unit/states_spec.rb
255
- - spec/unit/subscribers_spec.rb
256
- - spec/unit/target_spec.rb
257
- - spec/unit/terminated_spec.rb
258
- - spec/unit/transition/check_conditions_spec.rb
259
- - spec/unit/transition/inspect_spec.rb
260
- - spec/unit/transition/matches_spec.rb
261
- - spec/unit/transition/states_spec.rb
262
- - spec/unit/transition/to_state_spec.rb
263
- - spec/unit/trigger_spec.rb
264
- - spec/unit/undefined_transition/eql_spec.rb
138
+ test_files: []
data/Rakefile DELETED
@@ -1,12 +0,0 @@
1
- # encoding: utf-8
2
-
3
- require "bundler/gem_tasks"
4
-
5
- FileList['tasks/**/*.rake'].each(&method(:import))
6
-
7
- jruby = RUBY_ENGINE == 'ruby'
8
- specs = ['spec']
9
- specs << 'spec:perf' if jruby
10
-
11
- desc 'Run all specs'
12
- task ci: specs
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../lib/finite_machine'
4
- require 'ruby-prof'
5
-
6
- result = RubyProf.profile do
7
- FiniteMachine.new
8
- end
9
-
10
- printer = RubyProf::FlatPrinter.new(result)
11
- printer.print($stdout)