Class: NumberedListItem
- Inherits:
-
BasicToken
- Object
- BasicToken
- NumberedListItem
- Defined in:
- lib/rosetta/tokens/numbered_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
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
7 8 9 10 11 |
# File 'lib/rosetta/tokens/numbered_list_item.rb', line 7 def self.matches?(text) return false unless number?(text[0]) text[1..2] == '. ' end |
.number?(object) ⇒ Boolean
22 23 24 |
# File 'lib/rosetta/tokens/numbered_list_item.rb', line 22 def self.number?(object) object.to_s == object.to_i.to_s end |
Instance Method Details
#type ⇒ Object
13 14 15 |
# File 'lib/rosetta/tokens/numbered_list_item.rb', line 13 def type :NUMBERED_LIST_ITEM end |
#value ⇒ Object
17 18 19 20 |
# File 'lib/rosetta/tokens/numbered_list_item.rb', line 17 def value # If the code reaches here we know the first 3 chars are the list delimiter. @source_text[3..-1] end |