Class: VER::Keymap::Results::Incomplete
- Defined in:
- lib/ver/keymap.rb
Overview
Indicate that no result could be found yet.
Constant Summary
Constants inherited from Struct
Instance Attribute Summary collapse
-
#choices ⇒ Object
Returns the value of attribute choices.
-
#pattern ⇒ Object
Returns the value of attribute pattern.
Instance Method Summary collapse
Methods inherited from Struct
Instance Attribute Details
#choices ⇒ Object
Returns the value of attribute choices
15 16 17 |
# File 'lib/ver/keymap.rb', line 15 def choices @choices end |
#pattern ⇒ Object
Returns the value of attribute pattern
15 16 17 |
# File 'lib/ver/keymap.rb', line 15 def pattern @pattern end |
Instance Method Details
#merge!(incomplete) ⇒ Object
16 17 18 19 |
# File 'lib/ver/keymap.rb', line 16 def merge!(incomplete) return unless pattern == incomplete.pattern choices.deep_merge!(incomplete.choices) end |
#to_s(handler) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ver/keymap.rb', line 21 def to_s(handler) stack = pattern.map{|seq| Event[seq].keysym }.join follow = choices.map{|key, action| case action when Action method = action.to_method(handler) args = [*action.invocation][1..-1] case receiver = method.receiver when Class, Module signature = "#{receiver}.#{method.name}" else signature = "#{method.receiver.class}.#{method.name}" end unless args.empty? signature << '(' << args.map(&:inspect).join(', ') << ')' end "#{key} => #{signature}" when MapHash key else '%s => %p' % [key, action] end }.join(', ') "#{stack} -- (#{follow})" end |