com 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,8 +4,6 @@
4
4
  # releasing an observer and thus causes an unbreakable chain of objects,
5
5
  # causing uncollectable garbage. This class obviates most of the problems.
6
6
  class COM::Events
7
- ArgumentMissing = Object.new.freeze
8
-
9
7
  # Creates a COM events wrapper for the COM object _com_’s _interface_.
10
8
  # Optionally, any _events_ may be given as additional arguments.
11
9
  #
@@ -24,8 +22,8 @@ class COM::Events
24
22
  # @param [Proc] during Block during which to observe _event_
25
23
  # @yield [*args] Event arguments (specific for each event)
26
24
  # @return The result of _during_
27
- def observe(event, observer = ArgumentMissing)
28
- if ArgumentMissing.equal? observer
25
+ def observe(event, observer = (default = true; nil))
26
+ if default
29
27
  register event, Proc.new
30
28
  return self
31
29
  end
@@ -42,8 +42,12 @@ class COM::Object
42
42
  end
43
43
  end
44
44
 
45
- def observe(event, observer = COM::Events::ArgumentMissing, &block)
46
- com.observe event, observer, &block
45
+ def observe(event, observer = (default = true; nil), &block)
46
+ if default
47
+ com.observe event, &block
48
+ else
49
+ com.observe event, observer, &block
50
+ end
47
51
  self
48
52
  end
49
53
 
@@ -1,5 +1,5 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  module COM
4
- Version = '0.3.0'
4
+ Version = '0.3.1'
5
5
  end
@@ -59,8 +59,12 @@ class COM::Wrapper
59
59
  end
60
60
  end
61
61
 
62
- def observe(event, observer = COM::Events::ArgumentMissing, &block)
63
- events.observe event, observer, &block
62
+ def observe(event, observer = (default = true; nil), &block)
63
+ if default
64
+ events.observe event, &block
65
+ else
66
+ events.observe event, observer, &block
67
+ end
64
68
  self
65
69
  end
66
70
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: com
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-14 00:00:00.000000000 Z
12
+ date: 2011-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: lookout
16
- requirement: &14503188 !ruby/object:Gem::Requirement
16
+ requirement: &2865252 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *14503188
24
+ version_requirements: *2865252
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: yard
27
- requirement: &14502792 !ruby/object:Gem::Requirement
27
+ requirement: &2864676 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 0.6.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *14502792
35
+ version_requirements: *2864676
36
36
  description: ! "# COM #\n\nCOM is an object-oriented wrapper around WIN32OLE. COM
37
37
  makes it easy to add\nbehavior to WIN32OLE objects, making them easier to work with
38
38
  from Ruby.\n\n\n## Usage ##\n\nUsing COM is rather straightforward. There’s basically