Class: Yatte::RenderContext

Inherits:
Data
  • Object
show all
Defined in:
lib/yatte/render_context.rb

Overview

Value object bundling everything Screen#refresh needs to paint the editor. Built by Editor#refresh_screen on every tick and passed whole to Screen.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#active_tab_indexObject (readonly)

Returns the value of attribute active_tab_index

Returns:

  • (Object)

    the current value of active_tab_index



6
7
8
# File 'lib/yatte/render_context.rb', line 6

def active_tab_index
  @active_tab_index
end

#bracket_matchObject (readonly)

Returns the value of attribute bracket_match

Returns:

  • (Object)

    the current value of bracket_match



6
7
8
# File 'lib/yatte/render_context.rb', line 6

def bracket_match
  @bracket_match
end

#bufferObject (readonly)

Returns the value of attribute buffer

Returns:

  • (Object)

    the current value of buffer



6
7
8
# File 'lib/yatte/render_context.rb', line 6

def buffer
  @buffer
end

#cursorObject (readonly)

Returns the value of attribute cursor

Returns:

  • (Object)

    the current value of cursor



6
7
8
# File 'lib/yatte/render_context.rb', line 6

def cursor
  @cursor
end

#dirtyObject (readonly)

Returns the value of attribute dirty

Returns:

  • (Object)

    the current value of dirty



6
7
8
# File 'lib/yatte/render_context.rb', line 6

def dirty
  @dirty
end

#filenameObject (readonly)

Returns the value of attribute filename

Returns:

  • (Object)

    the current value of filename



6
7
8
# File 'lib/yatte/render_context.rb', line 6

def filename
  @filename
end

#git_statusObject (readonly)

Returns the value of attribute git_status

Returns:

  • (Object)

    the current value of git_status



6
7
8
# File 'lib/yatte/render_context.rb', line 6

def git_status
  @git_status
end

#languageObject (readonly)

Returns the value of attribute language

Returns:

  • (Object)

    the current value of language



6
7
8
# File 'lib/yatte/render_context.rb', line 6

def language
  @language
end

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



6
7
8
# File 'lib/yatte/render_context.rb', line 6

def message
  @message
end

#message_timeObject (readonly)

Returns the value of attribute message_time

Returns:

  • (Object)

    the current value of message_time



6
7
8
# File 'lib/yatte/render_context.rb', line 6

def message_time
  @message_time
end

#selectionObject (readonly)

Returns the value of attribute selection

Returns:

  • (Object)

    the current value of selection



6
7
8
# File 'lib/yatte/render_context.rb', line 6

def selection
  @selection
end

#tabsObject (readonly)

Returns the value of attribute tabs

Returns:

  • (Object)

    the current value of tabs



6
7
8
# File 'lib/yatte/render_context.rb', line 6

def tabs
  @tabs
end

Class Method Details

.build(buffer:, cursor:, filename: nil, dirty: false, message: "", message_time: nil, selection: nil, bracket_match: nil, tabs: nil, active_tab_index: 0, language: :plain, git_status: nil) ⇒ Object

Factory with defaults for optional fields — keeps callers from having to spell out the six nil/empty values they don’t care about.



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/yatte/render_context.rb', line 13

def self.build(buffer:, cursor:, filename: nil, dirty: false,
  message: "", message_time: nil, selection: nil, bracket_match: nil,
  tabs: nil, active_tab_index: 0, language: :plain, git_status: nil)
  new(
    buffer: buffer, cursor: cursor, filename: filename, dirty: dirty,
    message: message, message_time: message_time,
    selection: selection, bracket_match: bracket_match,
    tabs: tabs, active_tab_index: active_tab_index,
    language: language, git_status: git_status
  )
end