fsevent 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/TODO +7 -0
- data/fsevent.gemspec +4 -2
- data/lib/fsevent.rb +2 -1
- data/lib/fsevent/valueiddevice.rb +56 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 717fd9c24a23ac9feb8d368adb2d93ce1f1adf0b
|
4
|
+
data.tar.gz: 0772a949f60980f999429c8f626ffb2bd250d99e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8c5ccf242522308dcf0f192bf1958ac8d4fa45bf0ade0e044c2c8ddca64f0c4a3e1d284055d0a44cd04ac39dbfaf8997330b5b873dca8d486046057d254879b
|
7
|
+
data.tar.gz: 3910521d60aa1c7b7195fe822211f55467c2320d6b79f56aa8b0d97b51ee5562c892cacc680af0fdbf737ce3128189103b80eed486feb3c668ee59f37400f51d
|
data/TODO
ADDED
data/fsevent.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'fsevent'
|
3
|
-
s.version = '0.
|
4
|
-
s.date = '2013-
|
3
|
+
s.version = '0.4'
|
4
|
+
s.date = '2013-07-01'
|
5
5
|
s.author = 'Tanaka Akira'
|
6
6
|
s.email = 'tanaka-akira@aist.go.jp'
|
7
7
|
s.license = 'GPL-3.0+'
|
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
.gitignore
|
13
13
|
LICENSE
|
14
14
|
README.md
|
15
|
+
TODO
|
15
16
|
fsevent.gemspec
|
16
17
|
lib/fsevent.rb
|
17
18
|
lib/fsevent/abstractdevice.rb
|
@@ -24,6 +25,7 @@ Gem::Specification.new do |s|
|
|
24
25
|
lib/fsevent/schedulemerger.rb
|
25
26
|
lib/fsevent/simpledevice.rb
|
26
27
|
lib/fsevent/util.rb
|
28
|
+
lib/fsevent/valueiddevice.rb
|
27
29
|
lib/fsevent/watchset.rb
|
28
30
|
sample/repeat.rb
|
29
31
|
sample/repeat2.rb
|
data/lib/fsevent.rb
CHANGED
@@ -32,6 +32,7 @@ require 'fsevent/debugdumper'
|
|
32
32
|
require 'fsevent/simpledevice'
|
33
33
|
require 'fsevent/processdevice'
|
34
34
|
require 'fsevent/processdevicec'
|
35
|
-
require 'fsevent/failsafedevice
|
35
|
+
require 'fsevent/failsafedevice'
|
36
36
|
require 'fsevent/schedulemerger'
|
37
37
|
require 'fsevent/periodicschedule'
|
38
|
+
require 'fsevent/valueiddevice'
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# valueiddevice.rb --- value identity device
|
2
|
+
#
|
3
|
+
# Copyright (C) 2014 National Institute of Advanced Industrial Science and Technology (AIST)
|
4
|
+
#
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
|
18
|
+
class FSEvent::ValueIdDevice < FSEvent::AbstractDevice
|
19
|
+
def initialize(device_name, target_device_name, status_name)
|
20
|
+
super device_name
|
21
|
+
@target_device_name = target_device_name
|
22
|
+
@status_name = status_name
|
23
|
+
@defined = false
|
24
|
+
@old_value = nil
|
25
|
+
@id = 0
|
26
|
+
end
|
27
|
+
|
28
|
+
def registered
|
29
|
+
add_watch @target_device_name, @status_name, :immediate
|
30
|
+
end
|
31
|
+
|
32
|
+
def run(watched_status, changed_status)
|
33
|
+
if watched_status.has_key?(@target_device_name) && watched_status[@target_device_name].has_key?(@status_name)
|
34
|
+
value, id = watched_status[@target_device_name][@status_name]
|
35
|
+
if !@defined
|
36
|
+
@id += 1
|
37
|
+
define_status(@status_name, [value, @id])
|
38
|
+
@defined = true
|
39
|
+
@old_value = value
|
40
|
+
else
|
41
|
+
if @old_value != value
|
42
|
+
@id += 1
|
43
|
+
modify_status(@status_name, [value, @id])
|
44
|
+
@old_value = value
|
45
|
+
end
|
46
|
+
end
|
47
|
+
else
|
48
|
+
if @defined
|
49
|
+
@id += 1
|
50
|
+
undefine_status(@status_name)
|
51
|
+
@defined = false
|
52
|
+
@old_value = nil
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fsevent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanaka Akira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: depq
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- ".gitignore"
|
49
49
|
- LICENSE
|
50
50
|
- README.md
|
51
|
+
- TODO
|
51
52
|
- fsevent.gemspec
|
52
53
|
- lib/fsevent.rb
|
53
54
|
- lib/fsevent/abstractdevice.rb
|
@@ -60,6 +61,7 @@ files:
|
|
60
61
|
- lib/fsevent/schedulemerger.rb
|
61
62
|
- lib/fsevent/simpledevice.rb
|
62
63
|
- lib/fsevent/util.rb
|
64
|
+
- lib/fsevent/valueiddevice.rb
|
63
65
|
- lib/fsevent/watchset.rb
|
64
66
|
- sample/repeat.rb
|
65
67
|
- sample/repeat2.rb
|