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.
-
#keys ⇒ Object
Returns the value of attribute keys.
-
#word_separator ⇒ Object
Returns the value of attribute word_separator.
Instance Method Summary collapse
-
#initialize(env: nil) ⇒ Environment
constructor
-
@history_size- the size of the editor history buffer (30).
-
- #initialize_line(&blk) ⇒ Object
Constructor Details
#initialize(env: 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).
94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/rawline/editor.rb', line 94 def initialize(env: nil) @env = env @keys = {} @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.
89 90 91 |
# File 'lib/rawline/editor.rb', line 89 def completion_class @completion_class end |
#history ⇒ Object
Returns the value of attribute history.
89 90 91 |
# File 'lib/rawline/editor.rb', line 89 def history @history end |
#keys ⇒ Object
Returns the value of attribute keys.
89 90 91 |
# File 'lib/rawline/editor.rb', line 89 def keys @keys end |
#word_separator ⇒ Object
Returns the value of attribute word_separator.
89 90 91 |
# File 'lib/rawline/editor.rb', line 89 def word_separator @word_separator end |
Instance Method Details
#initialize_line(&blk) ⇒ Object
109 110 111 112 113 |
# File 'lib/rawline/editor.rb', line 109 def initialize_line(&blk) Line.new(@line_history_size) do |line| blk.call(line) if blk end end |