perennial 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,25 @@
1
+ # Add instance exec when it's missing.
2
+ if !Object.new.respond_to?(:instance_exec, true)
3
+
4
+ class Object
5
+ module InstanceExecHelper; end
6
+ include InstanceExecHelper
7
+ def instance_exec(*args, &block)
8
+ begin
9
+ old_critical, Thread.critical = Thread.critical, true
10
+ n = 0
11
+ n += 1 while respond_to?(mname="__instance_exec#{n}")
12
+ InstanceExecHelper.module_eval{ define_method(mname, &block) }
13
+ ensure
14
+ Thread.critical = old_critical
15
+ end
16
+ begin
17
+ ret = send(mname, *args)
18
+ ensure
19
+ InstanceExecHelper.module_eval{ remove_method(mname) } rescue nil
20
+ end
21
+ ret
22
+ end
23
+ end
24
+
25
+ end
@@ -5,4 +5,5 @@ require 'perennial/core_ext/misc'
5
5
  require 'perennial/core_ext/hash_key_conversions'
6
6
  require 'perennial/core_ext/inflections'
7
7
  require 'perennial/core_ext/proxy'
8
- require 'perennial/core_ext/ansi_formatter'
8
+ require 'perennial/core_ext/ansi_formatter'
9
+ require 'perennial/core_ext/instance_exec'
@@ -167,7 +167,7 @@ module Perennial
167
167
  def process_action(name, data)
168
168
  self.event_handlers[name.to_s].each do |handler|
169
169
  if handler.respond_to?(:call)
170
- handler.call(data, self)
170
+ instance_exec(data, &handler)
171
171
  elsif handler.respond_to?(:handle)
172
172
  handler.handle(data)
173
173
  else
data/lib/perennial.rb CHANGED
@@ -9,7 +9,7 @@ require 'perennial/exceptions'
9
9
 
10
10
  module Perennial
11
11
 
12
- VERSION = [1, 2, 0]
12
+ VERSION = [1, 2, 1]
13
13
 
14
14
  has_library :dispatchable, :hookable, :loader, :logger, :nash,
15
15
  :loggable, :manifest, :settings, :argument_parser,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perennial
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darcy Laycock
@@ -61,6 +61,7 @@ files:
61
61
  - lib/perennial/core_ext/blank.rb
62
62
  - lib/perennial/core_ext/hash_key_conversions.rb
63
63
  - lib/perennial/core_ext/inflections.rb
64
+ - lib/perennial/core_ext/instance_exec.rb
64
65
  - lib/perennial/core_ext/misc.rb
65
66
  - lib/perennial/core_ext/proxy.rb
66
67
  - lib/perennial/daemon.rb