Class: Metro::EventData
- Inherits:
-
Object
- Object
- Metro::EventData
- Defined in:
- lib/metro/events/event_data.rb
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#mouse_point ⇒ Object
readonly
Returns the value of attribute mouse_point.
Class Method Summary collapse
- .modifier_key_list ⇒ Object
-
.modifier_key_list_names ⇒ Object
TODO: This attempt to reduce duplication is brittle and will likely end in heartache.
Instance Method Summary collapse
- #capture_modifier_keys(window) ⇒ Object
-
#initialize(window) ⇒ EventData
constructor
A new instance of EventData.
- #modifier_keys ⇒ Object
Constructor Details
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/metro/events/event_data.rb', line 4 def created_at @created_at end |
#mouse_point ⇒ Object (readonly)
Returns the value of attribute mouse_point.
4 5 6 |
# File 'lib/metro/events/event_data.rb', line 4 def mouse_point @mouse_point end |
Class Method Details
.modifier_key_list ⇒ Object
34 35 36 |
# File 'lib/metro/events/event_data.rb', line 34 def self.modifier_key_list @modifier_key_list ||= modifier_key_list_names.map {|key| "Gosu::#{key}".constantize } end |
.modifier_key_list_names ⇒ Object
TODO: This attempt to reduce duplication is brittle and will likely end in heartache.
27 28 29 30 31 32 |
# File 'lib/metro/events/event_data.rb', line 27 def self.modifier_key_list_names @modifier_key_list_names ||= %w[ KbLeftControl KbRightControl KbLeftAlt KbRightAlt KbLeftMeta KbRightMeta KbLeftShift KbRightShift ] end |
Instance Method Details
#capture_modifier_keys(window) ⇒ Object
17 18 19 20 21 |
# File 'lib/metro/events/event_data.rb', line 17 def capture_modifier_keys(window) self.class.modifier_key_list.each do |key| modifier_keys[key] = window.(key) end end |
#modifier_keys ⇒ Object
13 14 15 |
# File 'lib/metro/events/event_data.rb', line 13 def modifier_keys @modifier_keys ||= {} end |