Class: Fusuma::Config
- Inherits:
-
Object
- Object
- Fusuma::Config
- Includes:
- Singleton
- Defined in:
- lib/fusuma/config.rb
Overview
read keymap from yaml file
Instance Attribute Summary collapse
-
#keymap ⇒ Object
Returns the value of attribute keymap.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #reload ⇒ Object
- #shortcut(gesture_info) ⇒ Object
- #threshold(action_type) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
22 23 24 |
# File 'lib/fusuma/config.rb', line 22 def initialize reload end |
Instance Attribute Details
#keymap ⇒ Object
Returns the value of attribute keymap.
25 26 27 |
# File 'lib/fusuma/config.rb', line 25 def keymap @keymap end |
Class Method Details
.reload ⇒ Object
17 18 19 |
# File 'lib/fusuma/config.rb', line 17 def reload instance.reload end |
.shortcut(gesture_info) ⇒ Object
9 10 11 |
# File 'lib/fusuma/config.rb', line 9 def shortcut(gesture_info) instance.shortcut(gesture_info) end |
.threshold(action_type) ⇒ Object
13 14 15 |
# File 'lib/fusuma/config.rb', line 13 def threshold(action_type) instance.threshold(action_type) end |
Instance Method Details
#reload ⇒ Object
27 28 29 30 31 |
# File 'lib/fusuma/config.rb', line 27 def reload @cache = nil @keymap = YAML.load_file(file_path) self end |
#shortcut(gesture_info) ⇒ Object
33 34 35 36 |
# File 'lib/fusuma/config.rb', line 33 def shortcut(gesture_info) seek_index = [*action_index(gesture_info), 'shortcut'] cache(seek_index) { search_config(keymap, seek_index) } end |
#threshold(action_type) ⇒ Object
38 39 40 41 |
# File 'lib/fusuma/config.rb', line 38 def threshold(action_type) seek_index = ['threshold', action_type] cache(seek_index) { search_config(keymap, seek_index) } || 1 end |