Class: Vedeu::Editor::Editor Private
- Inherits:
-
Object
- Object
- Vedeu::Editor::Editor
- Extended by:
- Forwardable
- Defined in:
- lib/vedeu/editor/editor.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Handles keypresses for a named document whilst the terminal is in fake mode.
Instance Attribute Summary collapse
- #input ⇒ Symbol|String readonly protected private
-
#name ⇒ NilClass|Symbol|String
readonly
protected
private
The name of the model, the target model or the name of the associated model.
Class Method Summary collapse
-
.keypress(input:, name:) ⇒ String|Symbol
private
Send given input to the named document.
Instance Method Summary collapse
-
#document ⇒ Vedeu::Editor::Document
private
private
Returns the named document from the documents repository.
-
#initialize(input:, name:) ⇒ Vedeu::Editor::Editor
constructor
private
Returns a new instance of Vedeu::Editor::Editor.
-
#keypress ⇒ String|Symbol
private
Send given input to the named document.
Constructor Details
#initialize(input:, name:) ⇒ Vedeu::Editor::Editor
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Vedeu::Editor::Editor.
43 44 45 46 |
# File 'lib/vedeu/editor/editor.rb', line 43 def initialize(input:, name:) @input = input @name = name end |
Instance Attribute Details
#input ⇒ Symbol|String (readonly, protected)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
74 75 76 |
# File 'lib/vedeu/editor/editor.rb', line 74 def input @input end |
#name ⇒ NilClass|Symbol|String (readonly, protected)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns The name of the model, the target model or the name of the associated model.
78 79 80 |
# File 'lib/vedeu/editor/editor.rb', line 78 def name @name end |
Class Method Details
.keypress(input:, name:) ⇒ String|Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Send given input to the named document.
34 35 36 |
# File 'lib/vedeu/editor/editor.rb', line 34 def self.keypress(input:, name:) new(input: input, name: name).keypress end |
Instance Method Details
#document ⇒ Vedeu::Editor::Document (private)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the named document from the documents repository.
83 84 85 |
# File 'lib/vedeu/editor/editor.rb', line 83 def document @document ||= Vedeu.documents.by_name(name) end |
#keypress ⇒ String|Symbol
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Send given input to the named document.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/vedeu/editor/editor.rb', line 51 def keypress return input unless document case input when :backspace then delete_character when :delete then delete_line when :ctrl_c then Vedeu.trigger(:_exit_) when :down then down when :enter then insert_line when :escape then Vedeu.trigger(:_mode_switch_) when :left then left when :right then right when :tab then execute when :up then up else insert_character(input) end end |