Class: BasicListItem

Inherits:
BasicToken show all
Defined in:
lib/rosetta/tokens/basic_list_item.rb

Overview

Handles logic for Header tokens

Constant Summary

Constants inherited from BasicToken

BasicToken::INLINE_CLASS_NAMES, BasicToken::TOP_LEVEL_CLASS_NAMES

Instance Attribute Summary

Attributes inherited from BasicToken

#source_text

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BasicToken

#accept, #initialize, #inline?, #node_representation, #to_s

Constructor Details

This class inherits a constructor from BasicToken

Class Method Details

.matches?(text) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/rosetta/tokens/basic_list_item.rb', line 7

def self.matches?(text)
  text.start_with?('* ') || text.start_with?('- ')
end

Instance Method Details

#typeObject



11
12
13
# File 'lib/rosetta/tokens/basic_list_item.rb', line 11

def type
  :BASIC_LIST_ITEM
end

#valueObject



15
16
17
18
# File 'lib/rosetta/tokens/basic_list_item.rb', line 15

def value
  # If the code reaches here we know the first 2 chars are the list delimiter.
  @source_text[2..-1]
end