subtype 0.0.2 → 0.0.3
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/subtype.rb +92 -86
- metadata +3 -3
data/lib/subtype.rb
CHANGED
@@ -18,8 +18,8 @@
|
|
18
18
|
#++
|
19
19
|
|
20
20
|
class ::Subtle::Sublet
|
21
|
-
def use(
|
22
|
-
|
21
|
+
def use (klass)
|
22
|
+
klass.included(self)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -61,95 +61,101 @@ module SubType
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
Rotate
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
64
|
+
module Rotate
|
65
|
+
def self.included (klass)
|
66
|
+
klass.instance_eval {
|
67
|
+
alias __set_data__ data=
|
68
|
+
alias __get_data__ data
|
69
|
+
alias __on__ on
|
70
|
+
|
71
|
+
self.rotation = SubType::RotationType.new('', self.config[:length])
|
72
|
+
self.thread = Thread.start(self) {|s|
|
73
|
+
loop {
|
74
|
+
s.__set_data__(s.data.pre + s.data.next + s.data.post)
|
75
|
+
sleep 0.1
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
def data=(str)
|
80
|
+
self.rotation.update(str)
|
81
|
+
str
|
82
|
+
end
|
83
|
+
|
84
|
+
def data
|
85
|
+
self.rotation
|
86
|
+
end
|
87
|
+
|
88
|
+
def on(meth, &blk)
|
89
|
+
case meth
|
90
|
+
when :unload
|
91
|
+
__on__(meth) {|s|
|
92
|
+
blk.call(s)
|
93
|
+
s.thread.kill
|
94
|
+
}
|
95
|
+
else
|
96
|
+
__on__(meth, &blk)
|
97
|
+
end
|
98
|
+
end
|
92
99
|
}
|
93
|
-
else
|
94
|
-
__on__(meth, &blk)
|
95
100
|
end
|
96
101
|
end
|
97
|
-
EOF
|
98
|
-
|
99
|
-
Expand = <<-EOF
|
100
|
-
helper do
|
101
|
-
def __refresh
|
102
|
-
begin
|
103
|
-
self.data = self.respond_to?(:refresh) ? self.refresh : ''
|
104
|
-
rescue
|
105
|
-
self.data = 'ERROR'
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
on :run do |s|
|
111
|
-
s.type = s.type ? s.type : :short
|
112
|
-
s.__refresh
|
113
|
-
end
|
114
102
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
blk
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
103
|
+
module Expand
|
104
|
+
def self.included (klass)
|
105
|
+
klass.instance_eval {
|
106
|
+
helper do
|
107
|
+
def __refresh
|
108
|
+
self.data = self.respond_to?(:refresh) ? self.refresh : ''
|
109
|
+
rescue
|
110
|
+
self.data = 'ERROR'
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
on :run do |s|
|
115
|
+
s.type = s.type ? s.type : :short
|
116
|
+
s.__refresh
|
117
|
+
end
|
118
|
+
|
119
|
+
on :mouse_over do |s|
|
120
|
+
s.type = :long
|
121
|
+
s.__refresh
|
122
|
+
end
|
123
|
+
|
124
|
+
on :mouse_out do |s|
|
125
|
+
s.type = :short
|
126
|
+
s.__refresh
|
127
|
+
end
|
128
|
+
|
129
|
+
alias __on__ on
|
130
|
+
|
131
|
+
def on(meth, &blk)
|
132
|
+
case meth
|
133
|
+
when :run
|
134
|
+
__on__(meth) {|s|
|
135
|
+
s.type = s.type ? s.type : :short
|
136
|
+
blk.call(s)
|
137
|
+
s.__refresh
|
138
|
+
}
|
139
|
+
when :mouse_over
|
140
|
+
__on__(meth) {|s|
|
141
|
+
blk.call(s)
|
142
|
+
s.type = :long
|
143
|
+
s.__refresh
|
144
|
+
}
|
145
|
+
when :mouse_out
|
146
|
+
__on__(meth) {|s|
|
147
|
+
blk.call(s)
|
148
|
+
s.type = :short
|
149
|
+
s.__refresh
|
150
|
+
}
|
151
|
+
else
|
152
|
+
__on__(meth) {|*args|
|
153
|
+
blk.call(*args)
|
154
|
+
args.last.__refresh
|
155
|
+
}
|
156
|
+
end
|
157
|
+
end
|
151
158
|
}
|
152
159
|
end
|
153
160
|
end
|
154
|
-
EOF
|
155
161
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- shura
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-06-23 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|