Class: Textbringer::HighlightContext
- Inherits:
-
Object
- Object
- Textbringer::HighlightContext
- Defined in:
- lib/textbringer/highlight_context.rb
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
-
#highlight_end ⇒ Object
readonly
Returns the value of attribute highlight_end.
-
#highlight_start ⇒ Object
readonly
Returns the value of attribute highlight_start.
Instance Method Summary collapse
- #highlight(start_offset, end_offset, face) ⇒ Object
-
#initialize(buffer:, highlight_start:, highlight_end:, highlight_on:, highlight_off:) ⇒ HighlightContext
constructor
A new instance of HighlightContext.
Constructor Details
#initialize(buffer:, highlight_start:, highlight_end:, highlight_on:, highlight_off:) ⇒ HighlightContext
Returns a new instance of HighlightContext.
5 6 7 8 9 10 11 12 |
# File 'lib/textbringer/highlight_context.rb', line 5 def initialize(buffer:, highlight_start:, highlight_end:, highlight_on:, highlight_off:) @buffer = buffer @highlight_start = highlight_start @highlight_end = highlight_end @highlight_on = highlight_on @highlight_off = highlight_off end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
3 4 5 |
# File 'lib/textbringer/highlight_context.rb', line 3 def buffer @buffer end |
#highlight_end ⇒ Object (readonly)
Returns the value of attribute highlight_end.
3 4 5 |
# File 'lib/textbringer/highlight_context.rb', line 3 def highlight_end @highlight_end end |
#highlight_start ⇒ Object (readonly)
Returns the value of attribute highlight_start.
3 4 5 |
# File 'lib/textbringer/highlight_context.rb', line 3 def highlight_start @highlight_start end |
Instance Method Details
#highlight(start_offset, end_offset, face) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/textbringer/highlight_context.rb', line 14 def highlight(start_offset, end_offset, face) start_offset = @highlight_start if start_offset < @highlight_start && @highlight_start < end_offset @highlight_on[start_offset] = face @highlight_off[end_offset] = true end |