Class: SublimeDSL::SublimeText::Mouse::Click
- Inherits:
-
Object
- Object
- SublimeDSL::SublimeText::Mouse::Click
- Defined in:
- lib/sublime_dsl/sublime_text/mouse.rb
Overview
A mouse click: button + modifiers.
Instance Attribute Summary collapse
-
#button ⇒ Object
readonly
Returns the value of attribute button.
-
#modifiers ⇒ Object
readonly
Returns the value of attribute modifiers.
Instance Method Summary collapse
-
#initialize(modifiers, button) ⇒ Click
constructor
A new instance of Click.
- #to_h ⇒ Object
- #to_spec ⇒ Object (also: #to_s)
Constructor Details
#initialize(modifiers, button) ⇒ Click
Returns a new instance of Click.
127 128 129 130 |
# File 'lib/sublime_dsl/sublime_text/mouse.rb', line 127 def initialize(modifiers, ) @modifiers = modifiers @button = end |
Instance Attribute Details
#button ⇒ Object (readonly)
Returns the value of attribute button.
125 126 127 |
# File 'lib/sublime_dsl/sublime_text/mouse.rb', line 125 def @button end |
#modifiers ⇒ Object (readonly)
Returns the value of attribute modifiers.
125 126 127 |
# File 'lib/sublime_dsl/sublime_text/mouse.rb', line 125 def modifiers @modifiers end |
Instance Method Details
#to_h ⇒ Object
138 139 140 141 142 |
# File 'lib/sublime_dsl/sublime_text/mouse.rb', line 138 def to_h h = { 'button' => .st_name } h['modifiers'] = modifiers.map(&:st_name) unless modifiers.empty? h end |
#to_spec ⇒ Object Also known as: to_s
132 133 134 |
# File 'lib/sublime_dsl/sublime_text/mouse.rb', line 132 def to_spec [*modifiers.map(&:name), .name].join('+') end |