Class: SublimeDSL::SublimeText::Keyboard::KeyStroke
- Inherits:
-
Object
- Object
- SublimeDSL::SublimeText::Keyboard::KeyStroke
- Includes:
- Tools::ValueEquality
- Defined in:
- lib/sublime_dsl/sublime_text/keyboard.rb
Overview
A keystroke: modifiers + key.
Instance Attribute Summary collapse
-
#chr_dead ⇒ Object
Returns the value of attribute chr_dead.
-
#chr_event ⇒ Object
Returns the value of attribute chr_event.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#key_event ⇒ Object
Returns the value of attribute key_event.
-
#modifiers ⇒ Object
readonly
Returns the value of attribute modifiers.
-
#os_action ⇒ Object
Returns the value of attribute os_action.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(modifiers, key) ⇒ KeyStroke
constructor
A new instance of KeyStroke.
- #inspect ⇒ Object
- #to_spec ⇒ Object (also: #to_s)
- #type ⇒ Object
Methods included from Tools::ValueEquality
Constructor Details
#initialize(modifiers, key) ⇒ KeyStroke
Returns a new instance of KeyStroke.
403 404 405 406 407 408 409 410 |
# File 'lib/sublime_dsl/sublime_text/keyboard.rb', line 403 def initialize(modifiers, key) @modifiers = modifiers @key = key @key_event = nil @chr_event = nil @chr_dead = false @os_action = nil end |
Instance Attribute Details
#chr_dead ⇒ Object
Returns the value of attribute chr_dead.
400 401 402 |
# File 'lib/sublime_dsl/sublime_text/keyboard.rb', line 400 def chr_dead @chr_dead end |
#chr_event ⇒ Object
Returns the value of attribute chr_event.
399 400 401 |
# File 'lib/sublime_dsl/sublime_text/keyboard.rb', line 399 def chr_event @chr_event end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
397 398 399 |
# File 'lib/sublime_dsl/sublime_text/keyboard.rb', line 397 def key @key end |
#key_event ⇒ Object
Returns the value of attribute key_event.
398 399 400 |
# File 'lib/sublime_dsl/sublime_text/keyboard.rb', line 398 def key_event @key_event end |
#modifiers ⇒ Object (readonly)
Returns the value of attribute modifiers.
397 398 399 |
# File 'lib/sublime_dsl/sublime_text/keyboard.rb', line 397 def modifiers @modifiers end |
#os_action ⇒ Object
Returns the value of attribute os_action.
401 402 403 |
# File 'lib/sublime_dsl/sublime_text/keyboard.rb', line 401 def os_action @os_action end |
Instance Method Details
#<=>(other) ⇒ Object
433 434 435 436 437 |
# File 'lib/sublime_dsl/sublime_text/keyboard.rb', line 433 def <=>(other) c = self.key <=> other.key c = self.modifiers <=> other.modifiers if c == 0 c end |
#inspect ⇒ Object
422 423 424 425 426 427 428 429 |
# File 'lib/sublime_dsl/sublime_text/keyboard.rb', line 422 def inspect s = "<#KeyStroke #{to_spec}" s << " key_event=#{key_event.inspect}" s << " chr_event=#{chr_event.inspect}" s << " dead=true" if chr_dead s << " os_action=#{os_action.inspect}" if os_action s end |
#to_spec ⇒ Object Also known as: to_s
416 417 418 |
# File 'lib/sublime_dsl/sublime_text/keyboard.rb', line 416 def to_spec (modifiers.dup << key).map(&:to_s).join('+') end |
#type ⇒ Object
412 413 414 |
# File 'lib/sublime_dsl/sublime_text/keyboard.rb', line 412 def type :key end |