class Strikethrough

Handles logic for Strikethrough tokens

Constants

DELIMITER_TOKEN

Public Class Methods

consume(raw_text) click to toggle source
# File lib/rosetta/tokens/strikethrough.rb, line 12
def self.consume(raw_text)
  # Add an extra 1 to offset the extra delimiter length (because strikethrough).
  delimiter_index = raw_text[delimiter_length..].index(DELIMITER_TOKEN) + delimiter_length + 1

  source = raw_text[0..delimiter_index]
  new(source)
end

Public Instance Methods

type() click to toggle source
# File lib/rosetta/tokens/strikethrough.rb, line 20
def type
  :STRIKETHROUGH
end
value() click to toggle source
# File lib/rosetta/tokens/strikethrough.rb, line 24
def value
  return DELIMITER_TOKEN * 2 if @source_text == DELIMITER_TOKEN * 2

  @source_text[self.class.delimiter_length...-self.class.delimiter_length]
end