right_support 2.6.7 → 2.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,8 +26,7 @@ module RightSupport::Log
26
26
  # respond to all of the messages you care to send; this class will perform no error checking
27
27
  # for you!
28
28
  class Multiplexer
29
-
30
- # Access to underlying list of multiplexed objects
29
+ # Access to underlying list of multiplexed objects.
31
30
  attr_reader :targets
32
31
 
33
32
  # Prevent Kernel#warn from being called; #warn should be multiplexed to targets.
@@ -41,7 +40,7 @@ module RightSupport::Log
41
40
  @targets = targets || []
42
41
  end
43
42
 
44
- # Add object to list of multiplexed targets
43
+ # Add object to list of multiplexed targets.
45
44
  #
46
45
  # === Parameters
47
46
  # target(Object):: Add target to list of multiplexed targets
@@ -53,7 +52,7 @@ module RightSupport::Log
53
52
  self
54
53
  end
55
54
 
56
- # Remove object from list of multiplexed targets
55
+ # Remove object from list of multiplexed targets.
57
56
  #
58
57
  # === Parameters
59
58
  # target(Object):: Remove target from list of multiplexed targets
@@ -65,7 +64,7 @@ module RightSupport::Log
65
64
  self
66
65
  end
67
66
 
68
- # Access target at given index
67
+ # Access target at given index.
69
68
  #
70
69
  # === Parameters
71
70
  # index(Integer):: Target index
@@ -76,7 +75,7 @@ module RightSupport::Log
76
75
  target = @targets[index]
77
76
  end
78
77
 
79
- # Forward any method invocation to targets
78
+ # Forward any method invocation to targets.
80
79
  #
81
80
  # === Parameters
82
81
  # m(Symbol):: Method that should be multiplexed
@@ -89,5 +88,21 @@ module RightSupport::Log
89
88
  res[0]
90
89
  end
91
90
 
91
+ # Adhere to method_missing/respond_to metacontract: claim we
92
+ # respond to the message if any of our targets does.
93
+ #
94
+ # Dispatch will still fail if not ALL of the targets respond
95
+ # to a given method, hence the caveat that the user of this class
96
+ # needs to ensure his targets are duck-type compatible with the
97
+ # way they'll be used.
98
+ #
99
+ # === Parameters
100
+ # m(Symbol):: Name of method
101
+ #
102
+ # === Return
103
+ # respond_to(true|false):: true if this object or its targets respond to m, false otherwise
104
+ def respond_to?(m)
105
+ super(m) || @targets.any? { |t| t.respond_to?(m) }
106
+ end
92
107
  end
93
108
  end
@@ -7,8 +7,8 @@ spec = Gem::Specification.new do |s|
7
7
  s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
8
8
 
9
9
  s.name = 'right_support'
10
- s.version = '2.6.7'
11
- s.date = '2012-12-13'
10
+ s.version = '2.6.8'
11
+ s.date = '2012-12-14'
12
12
 
13
13
  s.authors = ['Tony Spataro', 'Sergey Sergyenko', 'Ryan Williamson', 'Lee Kirchhoff', 'Sergey Enin', 'Alexey Karpik', 'Scott Messier']
14
14
  s.email = 'support@rightscale.com'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_support
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 6
9
- - 7
10
- version: 2.6.7
9
+ - 8
10
+ version: 2.6.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tony Spataro
@@ -21,7 +21,7 @@ autorequire:
21
21
  bindir: bin
22
22
  cert_chain: []
23
23
 
24
- date: 2012-12-13 00:00:00 -08:00
24
+ date: 2012-12-14 00:00:00 -08:00
25
25
  default_executable:
26
26
  dependencies: []
27
27