Class: GTK::KeyboardKeys

Inherits:
Object show all
Includes:
Serialize
Defined in:
dragon/inputs.rb

Overview

Represents all the keys available on the keyboard.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object


307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# File 'dragon/inputs.rb', line 307

def method_missing m, *args
  begin
    define_singleton_method(m) do
      r = self.instance_variable_get("@#{m.without_ending_bang}".to_sym)
      clear_key m
      return r
    end

    return self.send m
  rescue Exception => e
    log_important "#{e}"
  end

  raise <<-S
* ERROR:
There is no member on the keyboard called #{m}. Here is a to_s representation of what's available:

#{KeyboardKeys.char_to_method_hash.map { |k, v| "[#{k} => #{v.join(",")}]" }.join("  ")}

S
end

Instance Attribute Details

#aObject

Returns the value of attribute a


13
14
15
# File 'dragon/inputs.rb', line 13

def a
  @a
end

#altObject

Returns the value of attribute alt


13
14
15
# File 'dragon/inputs.rb', line 13

def alt
  @alt
end

#alt_leftObject

Returns the value of attribute alt_left


13
14
15
# File 'dragon/inputs.rb', line 13

def alt_left
  @alt_left
end

#alt_rightObject

Returns the value of attribute alt_right


13
14
15
# File 'dragon/inputs.rb', line 13

def alt_right
  @alt_right
end

#ampersandObject

Returns the value of attribute ampersand


13
14
15
# File 'dragon/inputs.rb', line 13

def ampersand
  @ampersand
end

#asteriskObject

Returns the value of attribute asterisk


13
14
15
# File 'dragon/inputs.rb', line 13

def asterisk
  @asterisk
end

#atObject

Returns the value of attribute at


13
14
15
# File 'dragon/inputs.rb', line 13

def at
  @at
end

#bObject

Returns the value of attribute b


13
14
15
# File 'dragon/inputs.rb', line 13

def b
  @b
end

#back_slashObject

Returns the value of attribute back_slash


13
14
15
# File 'dragon/inputs.rb', line 13

def back_slash
  @back_slash
end

#backspaceObject

Returns the value of attribute backspace


13
14
15
# File 'dragon/inputs.rb', line 13

def backspace
  @backspace
end

#backtickObject

Returns the value of attribute backtick


13
14
15
# File 'dragon/inputs.rb', line 13

def backtick
  @backtick
end

#cObject

Returns the value of attribute c


13
14
15
# File 'dragon/inputs.rb', line 13

def c
  @c
end

#caratObject

Returns the value of attribute carat


13
14
15
# File 'dragon/inputs.rb', line 13

def carat
  @carat
end

#charObject

Returns the value of attribute char


13
14
15
# File 'dragon/inputs.rb', line 13

def char
  @char
end

#circumflexObject

Returns the value of attribute circumflex


13
14
15
# File 'dragon/inputs.rb', line 13

def circumflex
  @circumflex
end

#close_curly_braceObject

Returns the value of attribute close_curly_brace


13
14
15
# File 'dragon/inputs.rb', line 13

def close_curly_brace
  @close_curly_brace
end

#close_round_braceObject

Returns the value of attribute close_round_brace


13
14
15
# File 'dragon/inputs.rb', line 13

def close_round_brace
  @close_round_brace
end

#close_square_braceObject

Returns the value of attribute close_square_brace


13
14
15
# File 'dragon/inputs.rb', line 13

def close_square_brace
  @close_square_brace
end

#colonObject

Returns the value of attribute colon


13
14
15
# File 'dragon/inputs.rb', line 13

def colon
  @colon
end

#commaObject

Returns the value of attribute comma


13
14
15
# File 'dragon/inputs.rb', line 13

def comma
  @comma
end

#controlObject

Returns the value of attribute control


13
14
15
# File 'dragon/inputs.rb', line 13

def control
  @control
end

#control_leftObject

Returns the value of attribute control_left


13
14
15
# File 'dragon/inputs.rb', line 13

def control_left
  @control_left
end

#control_rightObject

Returns the value of attribute control_right


13
14
15
# File 'dragon/inputs.rb', line 13

def control_right
  @control_right
end

#dObject

Returns the value of attribute d


13
14
15
# File 'dragon/inputs.rb', line 13

def d
  @d
end

#deleteObject

Returns the value of attribute delete


13
14
15
# File 'dragon/inputs.rb', line 13

def delete
  @delete
end

#dollar_signObject

Returns the value of attribute dollar_sign


13
14
15
# File 'dragon/inputs.rb', line 13

def dollar_sign
  @dollar_sign
end

#double_quotation_markObject

Returns the value of attribute double_quotation_mark


13
14
15
# File 'dragon/inputs.rb', line 13

def double_quotation_mark
  @double_quotation_mark
end

#downObject

Returns the value of attribute down


13
14
15
# File 'dragon/inputs.rb', line 13

def down
  @down
end

#eObject

Returns the value of attribute e


13
14
15
# File 'dragon/inputs.rb', line 13

def e
  @e
end

#eightObject

Returns the value of attribute eight


13
14
15
# File 'dragon/inputs.rb', line 13

def eight
  @eight
end

#endObject

Returns the value of attribute end


13
14
15
# File 'dragon/inputs.rb', line 13

def end
  @end
end

#enterObject

Returns the value of attribute enter


13
14
15
# File 'dragon/inputs.rb', line 13

def enter
  @enter
end

#equal_signObject

Returns the value of attribute equal_sign


13
14
15
# File 'dragon/inputs.rb', line 13

def equal_sign
  @equal_sign
end

#escapeObject

Returns the value of attribute escape


13
14
15
# File 'dragon/inputs.rb', line 13

def escape
  @escape
end

#exclamation_pointObject

Returns the value of attribute exclamation_point


13
14
15
# File 'dragon/inputs.rb', line 13

def exclamation_point
  @exclamation_point
end

#fObject

Returns the value of attribute f


13
14
15
# File 'dragon/inputs.rb', line 13

def f
  @f
end

#fiveObject

Returns the value of attribute five


13
14
15
# File 'dragon/inputs.rb', line 13

def five
  @five
end

#forward_slashObject

Returns the value of attribute forward_slash


13
14
15
# File 'dragon/inputs.rb', line 13

def forward_slash
  @forward_slash
end

#fourObject

Returns the value of attribute four


13
14
15
# File 'dragon/inputs.rb', line 13

def four
  @four
end

#gObject

Returns the value of attribute g


13
14
15
# File 'dragon/inputs.rb', line 13

def g
  @g
end

#greater_thanObject

Returns the value of attribute greater_than


13
14
15
# File 'dragon/inputs.rb', line 13

def greater_than
  @greater_than
end

#hObject

Returns the value of attribute h


13
14
15
# File 'dragon/inputs.rb', line 13

def h
  @h
end

#homeObject

Returns the value of attribute home


13
14
15
# File 'dragon/inputs.rb', line 13

def home
  @home
end

#hyphenObject

Returns the value of attribute hyphen


13
14
15
# File 'dragon/inputs.rb', line 13

def hyphen
  @hyphen
end

#iObject

Returns the value of attribute i


13
14
15
# File 'dragon/inputs.rb', line 13

def i
  @i
end

#jObject

Returns the value of attribute j


13
14
15
# File 'dragon/inputs.rb', line 13

def j
  @j
end

#kObject

Returns the value of attribute k


13
14
15
# File 'dragon/inputs.rb', line 13

def k
  @k
end

#lObject

Returns the value of attribute l


13
14
15
# File 'dragon/inputs.rb', line 13

def l
  @l
end

#leftObject

Returns the value of attribute left


13
14
15
# File 'dragon/inputs.rb', line 13

def left
  @left
end

#less_thanObject

Returns the value of attribute less_than


13
14
15
# File 'dragon/inputs.rb', line 13

def less_than
  @less_than
end

#mObject

Returns the value of attribute m


13
14
15
# File 'dragon/inputs.rb', line 13

def m
  @m
end

#metaObject

Returns the value of attribute meta


13
14
15
# File 'dragon/inputs.rb', line 13

def meta
  @meta
end

#meta_leftObject

Returns the value of attribute meta_left


13
14
15
# File 'dragon/inputs.rb', line 13

def meta_left
  @meta_left
end

#meta_rightObject

Returns the value of attribute meta_right


13
14
15
# File 'dragon/inputs.rb', line 13

def meta_right
  @meta_right
end

#nObject

Returns the value of attribute n


13
14
15
# File 'dragon/inputs.rb', line 13

def n
  @n
end

#nineObject

Returns the value of attribute nine


13
14
15
# File 'dragon/inputs.rb', line 13

def nine
  @nine
end

#oObject

Returns the value of attribute o


13
14
15
# File 'dragon/inputs.rb', line 13

def o
  @o
end

#oneObject

Returns the value of attribute one


13
14
15
# File 'dragon/inputs.rb', line 13

def one
  @one
end

#open_curly_braceObject

Returns the value of attribute open_curly_brace


13
14
15
# File 'dragon/inputs.rb', line 13

def open_curly_brace
  @open_curly_brace
end

#open_round_braceObject

Returns the value of attribute open_round_brace


13
14
15
# File 'dragon/inputs.rb', line 13

def open_round_brace
  @open_round_brace
end

#open_square_braceObject

Returns the value of attribute open_square_brace


13
14
15
# File 'dragon/inputs.rb', line 13

def open_square_brace
  @open_square_brace
end

#ordinal_indicatorObject

Returns the value of attribute ordinal_indicator


13
14
15
# File 'dragon/inputs.rb', line 13

def ordinal_indicator
  @ordinal_indicator
end

#pObject

Returns the value of attribute p


13
14
15
# File 'dragon/inputs.rb', line 13

def p
  @p
end

#pagedownObject

Returns the value of attribute pagedown


13
14
15
# File 'dragon/inputs.rb', line 13

def pagedown
  @pagedown
end

#pageupObject

Returns the value of attribute pageup


13
14
15
# File 'dragon/inputs.rb', line 13

def pageup
  @pageup
end

#periodObject

Returns the value of attribute period


13
14
15
# File 'dragon/inputs.rb', line 13

def period
  @period
end

#pipeObject

Returns the value of attribute pipe


13
14
15
# File 'dragon/inputs.rb', line 13

def pipe
  @pipe
end

#plusObject

Returns the value of attribute plus


13
14
15
# File 'dragon/inputs.rb', line 13

def plus
  @plus
end

#qObject

Returns the value of attribute q


13
14
15
# File 'dragon/inputs.rb', line 13

def q
  @q
end

#question_markObject

Returns the value of attribute question_mark


13
14
15
# File 'dragon/inputs.rb', line 13

def question_mark
  @question_mark
end

#rObject

Returns the value of attribute r


13
14
15
# File 'dragon/inputs.rb', line 13

def r
  @r
end

#raw_keyObject

Returns the value of attribute raw_key


13
14
15
# File 'dragon/inputs.rb', line 13

def raw_key
  @raw_key
end

#rightObject

Returns the value of attribute right


13
14
15
# File 'dragon/inputs.rb', line 13

def right
  @right
end

#sObject

Returns the value of attribute s


13
14
15
# File 'dragon/inputs.rb', line 13

def s
  @s
end

#section_signObject

Returns the value of attribute section_sign


13
14
15
# File 'dragon/inputs.rb', line 13

def section_sign
  @section_sign
end

#semicolonObject

Returns the value of attribute semicolon


13
14
15
# File 'dragon/inputs.rb', line 13

def semicolon
  @semicolon
end

#sevenObject

Returns the value of attribute seven


13
14
15
# File 'dragon/inputs.rb', line 13

def seven
  @seven
end

#shiftObject

Returns the value of attribute shift


13
14
15
# File 'dragon/inputs.rb', line 13

def shift
  @shift
end

#shift_leftObject

Returns the value of attribute shift_left


13
14
15
# File 'dragon/inputs.rb', line 13

def shift_left
  @shift_left
end

#shift_rightObject

Returns the value of attribute shift_right


13
14
15
# File 'dragon/inputs.rb', line 13

def shift_right
  @shift_right
end

#single_quotation_markObject

Returns the value of attribute single_quotation_mark


13
14
15
# File 'dragon/inputs.rb', line 13

def single_quotation_mark
  @single_quotation_mark
end

#sixObject

Returns the value of attribute six


13
14
15
# File 'dragon/inputs.rb', line 13

def six
  @six
end

#spaceObject

Returns the value of attribute space


13
14
15
# File 'dragon/inputs.rb', line 13

def space
  @space
end

#superscript_twoObject

Returns the value of attribute superscript_two


13
14
15
# File 'dragon/inputs.rb', line 13

def superscript_two
  @superscript_two
end

#tObject

Returns the value of attribute t


13
14
15
# File 'dragon/inputs.rb', line 13

def t
  @t
end

#tabObject

Returns the value of attribute tab


13
14
15
# File 'dragon/inputs.rb', line 13

def tab
  @tab
end

#threeObject

Returns the value of attribute three


13
14
15
# File 'dragon/inputs.rb', line 13

def three
  @three
end

#tildeObject

Returns the value of attribute tilde


13
14
15
# File 'dragon/inputs.rb', line 13

def tilde
  @tilde
end

#twoObject

Returns the value of attribute two


13
14
15
# File 'dragon/inputs.rb', line 13

def two
  @two
end

#uObject

Returns the value of attribute u


13
14
15
# File 'dragon/inputs.rb', line 13

def u
  @u
end

#underscoreObject

Returns the value of attribute underscore


13
14
15
# File 'dragon/inputs.rb', line 13

def underscore
  @underscore
end

#upObject

Returns the value of attribute up


13
14
15
# File 'dragon/inputs.rb', line 13

def up
  @up
end

#vObject

Returns the value of attribute v


13
14
15
# File 'dragon/inputs.rb', line 13

def v
  @v
end

#wObject

Returns the value of attribute w


13
14
15
# File 'dragon/inputs.rb', line 13

def w
  @w
end

#xObject

Returns the value of attribute x


13
14
15
# File 'dragon/inputs.rb', line 13

def x
  @x
end

#yObject

Returns the value of attribute y


13
14
15
# File 'dragon/inputs.rb', line 13

def y
  @y
end

#zObject

Returns the value of attribute z


13
14
15
# File 'dragon/inputs.rb', line 13

def z
  @z
end

#zeroObject

Returns the value of attribute zero


13
14
15
# File 'dragon/inputs.rb', line 13

def zero
  @zero
end

Class Method Details

.char_to_method(char, int = nil) ⇒ Object


194
195
196
197
# File 'dragon/inputs.rb', line 194

def self.char_to_method char, int = nil
  methods = char_to_method_hash[char] || char_to_method_hash[int]
  methods ? methods.dup : [char.to_sym || int]
end

.char_to_method_hashObject


96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'dragon/inputs.rb', line 96

def self.char_to_method_hash
  @char_to_method ||= {
    'A'  => [:a],
    'B'  => [:b],
    'C'  => [:c],
    'D'  => [:d],
    'E'  => [:e],
    'F'  => [:f],
    'G'  => [:g],
    'H'  => [:h],
    'I'  => [:i],
    'J'  => [:j],
    'K'  => [:k],
    'L'  => [:l],
    'M'  => [:m],
    'N'  => [:n],
    'O'  => [:o],
    'P'  => [:p],
    'Q'  => [:q],
    'R'  => [:r],
    'S'  => [:s],
    'T'  => [:t],
    'U'  => [:u],
    'V'  => [:v],
    'W'  => [:w],
    'X'  => [:x],
    'Y'  => [:y],
    'Z'  => [:z],
    "!"  => [:exclamation_point],
    "0"  => [:zero],
    "1"  => [:one],
    "2"  => [:two],
    "3"  => [:three],
    "4"  => [:four],
    "5"  => [:five],
    "6"  => [:six],
    "7"  => [:seven],
    "8"  => [:eight],
    "9"  => [:nine],
    "\b" => [:backspace],
    "\e" => [:escape],
    "\r" => [:enter],
    "\t" => [:tab],
    "("  => [:open_round_brace],
    ")"  => [:close_round_brace],
    "{"  => [:open_curly_brace],
    "}"  => [:close_curly_brace],
    "["  => [:open_square_brace],
    "]"  => [:close_square_brace],
    ":"  => [:colon],
    ";"  => [:semicolon],
    "="  => [:equal_sign],
    "-"  => [:hyphen],
    " "  => [:space],
    "$"  => [:dollar_sign],
    "\"" => [:double_quotation_mark],
    "'"  => [:single_quotation_mark],
    "`"  => [:backtick],
    "~"  => [:tilde],
    "."  => [:period],
    ","  => [:comma],
    "|"  => [:pipe],
    "_"  => [:underscore],
    "#"  => [:hash],
    "+"  => [:plus],
    "@"  => [:at],
    "/"  => [:forward_slash],
    "\\" => [:back_slash],
    "*"  => [:asterisk],
    "<"  => [:less_than],
    ">"  => [:greater_than],
    "^"  => [:circumflex],
    "&"  => [:ampersand],
    "²"  => [:superscript_two],
    "§"  => [:section_sign],
    "?"  => [:question_mark],
    '%'  => [:percent_sign],
    "º"  => [:ordinal_indicator],
    1073741898 => [:home],
    1073741901 => [:end],
    1073741903 => [:right],
    1073741904 => [:left],
    1073741905 => [:down],
    1073741906 => [:up],
    1073741899 => [:pageup],
    1073741902 => [:pagedown],
    127 => [:delete],
    1073742049 => [:shift_left, :shift],
    1073742053 => [:shift_right, :shift],
    1073742048 => [:control_left, :control],
    1073742052 => [:control_right, :control],
    1073742050 => [:alt_left, :alt],
    1073742054 => [:alt_right, :alt],
    1073742051 => [:meta_left, :meta],
    1073742055 => [:meta_right, :meta]
  }
end

.char_with_shift(raw_key, modifier) ⇒ Object


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'dragon/inputs.rb', line 72

def self.char_with_shift raw_key, modifier
  return nil unless raw_key >= 0 && raw_key <= 255
  if modifier != 1 && modifier != 2 && modifier != 3
    return utf_8_char raw_key
  else
    @shift_keys ||= {
      '`' => '~', '-' => '_', "'" => '"', "1" => '!',
      "2" => '@', "3" => '#', "4" => '$', "5" => '%',
      "6" => '^', "7" => '&', "8" => '*', "9" => '(',
      "0" => ')', ";" => ":", "=" => "+", "[" => "{",
      "]" => "}", '\\'=> "|", '/' => "?", '.' => ">",
      ',' => "<", 'a' => 'A', 'b' => 'B', 'c' => 'C',
      'd' => 'D', 'e' => 'E', 'f' => 'F', 'g' => 'G',
      'h' => 'H', 'i' => 'I', 'j' => 'J', 'k' => 'K',
      'l' => 'L', 'm' => 'M', 'n' => 'N', 'o' => 'O',
      'p' => 'P', 'q' => 'Q', 'r' => 'R', 's' => 'S',
      't' => 'T', 'u' => 'U', 'v' => 'V', 'w' => 'W',
      'x' => 'X', 'y' => 'Y', 'z' => 'Z'
    }

    @shift_keys[raw_key.chr.to_s] || raw_key.chr.to_s
  end
end

.sdl_to_key(raw_key, modifier) ⇒ Object


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'dragon/inputs.rb', line 44

def self.sdl_to_key raw_key, modifier
  return nil unless (raw_key >= 0 && raw_key <= 255) ||
                    raw_key == 1073741903 ||
                    raw_key == 1073741904 ||
                    raw_key == 1073741905 ||
                    raw_key == 1073741906 ||
                    raw_key == 1073741899 ||
                    raw_key == 1073741902 ||
                    raw_key == 1073741898 ||
                    raw_key == 1073741901 ||
                    (raw_key >= 1073742048 && raw_key <= 1073742055) # Modifier Keys

  char = KeyboardKeys.char_with_shift raw_key, modifier
  names = KeyboardKeys.char_to_method char, raw_key
  names << :alt if (modifier & (256|512)) != 0    # alt key
  names << :meta if (modifier & (1024|2048)) != 0 # meta key (command/apple/windows key)
  names << :control if (modifier & (64|128)) != 0 # ctrl key
  names << :shift if (modifier & (1|2)) != 0      # shift key
  names
end

.utf_8_char(raw_key) ⇒ Object


65
66
67
68
69
70
# File 'dragon/inputs.rb', line 65

def self.utf_8_char raw_key
  return "²" if raw_key == 178
  return "§" if raw_key == 167
  return "º" if raw_key == 186
  return raw_key.chr
end

Instance Method Details

#allObject


263
264
265
266
267
268
269
# File 'dragon/inputs.rb', line 263

def all
  @scrubbed_ivars ||= self.instance_variables
                          .reject { |i| i == :@all || i == :@scrubbed_ivars }
                          .map { |i| i.to_s.gsub("@", "") }

  get(@scrubbed_ivars).map { |k, _| k }
end

#all?(keys) ⇒ Boolean

Returns:

  • (Boolean)

225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'dragon/inputs.rb', line 225

def all? keys
  values = get(keys.map { |k| k.without_ending_bang })
  all_true = values.all? do |k, v|
    v
  end

  if all_true
    keys.each do |k|
      clear_key k if k.end_with_bang?
    end
  end

  all_true
end

#any?(keys) ⇒ Boolean

Returns:

  • (Boolean)

241
242
243
244
245
246
247
248
249
250
251
252
253
254
# File 'dragon/inputs.rb', line 241

def any? keys
  values = get(keys.map { |k| k.without_ending_bang })
  any_true = values.any? do |k, v|
    v
  end

  if any_true
    keys.each do |k|
      clear_key k if k.end_with_bang?
    end
  end

  any_true
end

#clearObject


199
200
201
202
# File 'dragon/inputs.rb', line 199

def clear
  set truthy_keys, false
  @scrubbed_ivars = nil
end

#clear_key(key) ⇒ Object


257
258
259
260
# File 'dragon/inputs.rb', line 257

def clear_key key
  @scrubbed_ivars = nil
  self.instance_variable_set("@#{key.without_ending_bang}", false)
end

#get(collection) ⇒ Object


272
273
274
275
276
277
278
279
280
281
282
283
# File 'dragon/inputs.rb', line 272

def get collection
  return [] if collection.length == 0
  collection.map do |m|
    if m.end_with_bang?
      clear_after_return = true
    end

    value = self.instance_variable_get("@#{m.without_ending_bang}".to_sym)
    clear_key m if clear_after_return
    [m.without_ending_bang, value]
  end
end

#left_rightObject


205
206
207
208
209
# File 'dragon/inputs.rb', line 205

def left_right
  return -1 if self.left
  return  1 if self.right
  return  0
end

#serializeObject


329
330
331
332
333
334
# File 'dragon/inputs.rb', line 329

def serialize
  hash = super
  hash.delete(:scrubbed_ivars)
  hash[:truthy_keys] = self.truthy_keys
  hash
end

#set(collection, value = true) ⇒ Object


286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'dragon/inputs.rb', line 286

def set collection, value = true
  return if collection.length == 0
  @scrubbed_ivars = nil
  value = Kernel.tick_count if value

  collection.each do |m|
    self.instance_variable_set("@#{m.to_s}".to_sym, value)
  rescue Exception => e
    raise e, <<-S
* ERROR:
Attempted to set the a key on the DragonRuby GTK's Keyboard data
structure, but the property isn't available for raw_key #{raw_key} #{m}.

You should contact DragonRuby and tell them to associate the raw_key #{raw_key}
with a friendly property name (we are open to suggestions if you have any).
[GTK::KeyboardKeys#set, GTK::KeyboardKeys#char_to_method]

S
  end
end

#truthy_keysObject


219
220
221
222
# File 'dragon/inputs.rb', line 219

def truthy_keys
  get(all).find_all { |_, v| v }
          .map { |k, _| k.to_sym }
end

#up_downObject


212
213
214
215
216
# File 'dragon/inputs.rb', line 212

def up_down
  return  1 if self.up
  return -1 if self.down
  return  0
end