unimidi 0.2.4-i686-linux → 0.2.5-i686-linux
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.
- data/lib/unimidi.rb +1 -1
- data/lib/unimidi/congruous_api_adapter.rb +8 -2
- data/test/test_selectors.rb +8 -0
- metadata +3 -3
data/lib/unimidi.rb
CHANGED
@@ -20,7 +20,7 @@ module UniMIDI
|
|
20
20
|
|
21
21
|
# enable the device for use, can be passed a block to which the device will be passed back
|
22
22
|
def open(*a, &block)
|
23
|
-
@device.open(*a)
|
23
|
+
@device.open(*a) unless enabled?
|
24
24
|
unless block.nil?
|
25
25
|
begin
|
26
26
|
yield(self)
|
@@ -67,8 +67,14 @@ module UniMIDI
|
|
67
67
|
|
68
68
|
# returns the device at <em>index</em>
|
69
69
|
def use(index, &block)
|
70
|
+
index = case index
|
71
|
+
when :first then 0
|
72
|
+
when :last then all.size - 1
|
73
|
+
else index
|
74
|
+
end
|
70
75
|
use_device(all[index], &block)
|
71
76
|
end
|
77
|
+
alias_method :open, :use
|
72
78
|
|
73
79
|
def [](index)
|
74
80
|
all[index]
|
@@ -114,7 +120,7 @@ module UniMIDI
|
|
114
120
|
end
|
115
121
|
|
116
122
|
def use_device(device, &block)
|
117
|
-
device.open(&block)
|
123
|
+
device.open(&block)
|
118
124
|
device
|
119
125
|
end
|
120
126
|
|
data/test/test_selectors.rb
CHANGED
@@ -48,6 +48,14 @@ class SelectorTest < Test::Unit::TestCase
|
|
48
48
|
assert_equal(Input.all.first, i)
|
49
49
|
end
|
50
50
|
|
51
|
+
def test_use_with_symbol
|
52
|
+
sleep(1)
|
53
|
+
i = Input.use(:first)
|
54
|
+
assert_equal(true, i.enabled?)
|
55
|
+
assert_equal(Input.first, i)
|
56
|
+
assert_equal(Input.all.first, i)
|
57
|
+
end
|
58
|
+
|
51
59
|
def test_all
|
52
60
|
i = Input.all
|
53
61
|
assert_equal(Device.all_by_type[:input], Input.all)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unimidi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
prerelease:
|
6
6
|
platform: i686-linux
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-08 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: alsa-rawmidi
|
16
|
-
requirement: &
|
16
|
+
requirement: &70123075821500 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70123075821500
|
25
25
|
description: Platform Independent, realtime MIDI input and output for Ruby
|
26
26
|
email:
|
27
27
|
- ari.russo@gmail.com
|