3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/thingtank/shortcuts.rb', line 3
def self.included(klass)
klass.class_eval do
def >(klass_or_hash)
case klass_or_hash
when Array
last_character(klass_or_hash.first, klass_or_hash.last)
else
to_character(klass_or_hash)
end
end
def <(klass_or_hash)
case klass_or_hash
when Array
first_character(klass_or_hash.first, klass_or_hash.last)
else
to_character(klass_or_hash)
end
end
def << (arr)
klass, key, code= arr.flatten
if code
add_character(klass, key, &code)
else
add_character(klass, key)
end
end
end
end
|