Class: RawLine::Editor::Environment
- Inherits:
-
Object
- Object
- RawLine::Editor::Environment
- Defined in:
- lib/rawline/editor.rb
Instance Attribute Summary collapse
-
#completion_class ⇒ Object
Returns the value of attribute completion_class.
-
#history ⇒ Object
Returns the value of attribute history.
-
#keyboard_input_processors ⇒ Object
Returns the value of attribute keyboard_input_processors.
-
#keys ⇒ Object
Returns the value of attribute keys.
-
#terminal ⇒ Object
Returns the value of attribute terminal.
-
#word_separator ⇒ Object
Returns the value of attribute word_separator.
Instance Method Summary collapse
-
#initialize(env: nil, terminal: nil) ⇒ Environment
constructor
-
@history_size- the size of the editor history buffer (30).
-
- #initialize_line(&blk) ⇒ Object
Constructor Details
#initialize(env: nil, terminal: nil) ⇒ Environment
-
@history_size- the size of the editor history buffer (30). -
@keys- the keys (arrays of character codes) bound to specific actions. -
@line_history_size- the size of the editor line history buffer (50).
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/rawline/editor.rb', line 98 def initialize(env: nil, terminal: nil) @env = env @keys = KeyBindings.new(terminal: terminal) @keyboard_input_processors = [] @completion_class = Completer @line_history_size = 50 @history_size = 30 @history = HistoryBuffer.new(@history_size) do |h| h.duplicates = false; h.exclude = lambda { |item| item.strip == "" } end end |
Instance Attribute Details
#completion_class ⇒ Object
Returns the value of attribute completion_class.
91 92 93 |
# File 'lib/rawline/editor.rb', line 91 def completion_class @completion_class end |
#history ⇒ Object
Returns the value of attribute history.
91 92 93 |
# File 'lib/rawline/editor.rb', line 91 def history @history end |
#keyboard_input_processors ⇒ Object
Returns the value of attribute keyboard_input_processors.
92 93 94 |
# File 'lib/rawline/editor.rb', line 92 def keyboard_input_processors @keyboard_input_processors end |
#keys ⇒ Object
Returns the value of attribute keys.
91 92 93 |
# File 'lib/rawline/editor.rb', line 91 def keys @keys end |
#terminal ⇒ Object
Returns the value of attribute terminal.
93 94 95 |
# File 'lib/rawline/editor.rb', line 93 def terminal @terminal end |
#word_separator ⇒ Object
Returns the value of attribute word_separator.
91 92 93 |
# File 'lib/rawline/editor.rb', line 91 def word_separator @word_separator end |
Instance Method Details
#initialize_line(&blk) ⇒ Object
114 115 116 117 118 |
# File 'lib/rawline/editor.rb', line 114 def initialize_line(&blk) Line.new(@line_history_size) do |line| blk.call(line) if blk end end |