Class: Vita::Link

Inherits:
Struct
  • Object
show all
Defined in:
lib/vita/link.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contextObject

Returns the value of attribute context

Returns:

  • (Object)

    the current value of context



2
3
4
# File 'lib/vita/link.rb', line 2

def context
  @context
end

#context_positionObject

Returns the value of attribute context_position

Returns:

  • (Object)

    the current value of context_position



2
3
4
# File 'lib/vita/link.rb', line 2

def context_position
  @context_position
end

#from_noteObject

Returns the value of attribute from_note

Returns:

  • (Object)

    the current value of from_note



2
3
4
# File 'lib/vita/link.rb', line 2

def from_note
  @from_note
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



2
3
4
# File 'lib/vita/link.rb', line 2

def text
  @text
end

#to_noteObject

Returns the value of attribute to_note

Returns:

  • (Object)

    the current value of to_note



2
3
4
# File 'lib/vita/link.rb', line 2

def to_note
  @to_note
end

Instance Method Details

#highlightsObject



3
4
5
6
7
8
9
# File 'lib/vita/link.rb', line 3

def highlights
  [
    Highlight.new(context[0, context_position], false),
    Highlight.new(context[context_position, text.length], true),
    Highlight.new(context[(context_position + text.length)..], false)
  ].reject(&:empty?)
end