Class: MaRuKu::MDLine
Overview
Represents a single line in a Markdown source file, as produced by LineSource.
Constant Summary
Constants inherited from String
String::Textile2_EmptyLine, String::Textile2_Signature
Instance Method Summary collapse
- #gsub!(*args) ⇒ Object
- #md_type ⇒ Object
-
#number_of_leading_spaces ⇒ Fixnum
Returns the number of leading spaces on this string, considering that a tab counts as Strings::TAB_SIZE spaces.
Methods inherited from String
#t2_contains_signature?, #t2_empty?, #t2_get_signature
Instance Method Details
#gsub!(*args) ⇒ Object
25 26 27 28 29 |
# File 'lib/maruku/input/mdline.rb', line 25 def gsub!(*args) # Any in-place-modification method should reset the md_type @md_type = nil super end |
#md_type ⇒ Object
7 8 9 |
# File 'lib/maruku/input/mdline.rb', line 7 def md_type @md_type ||= line_md_type end |
#number_of_leading_spaces ⇒ Fixnum
Returns the number of leading spaces on this string, considering that a tab counts as Strings::TAB_SIZE spaces.
16 17 18 19 20 21 22 23 |
# File 'lib/maruku/input/mdline.rb', line 16 def number_of_leading_spaces if self =~ /\A\s+/ spaces = $& spaces.count(" ") + spaces.count("\t") * MaRuKu::Strings::TAB_SIZE else 0 end end |