module HamdownCore::RubyMultiline

Public Class Methods

read(line_parser, current_text) click to toggle source
# File lib/hamdown_core/ruby_multiline.rb, line 4
def self.read(line_parser, current_text)
  buf = []
  while is_ruby_multiline?(current_text)
    current_text = line_parser.next_line
    buf << current_text
  end
  buf
end

Private Class Methods

is_ruby_multiline?(text) click to toggle source

`text' is a Ruby multiline block if it:

  • ends with a comma

  • but not “?,” which is a character literal (however, “x?,” is a method call and not a literal)

  • and not “?,” which is a character literal

# File lib/hamdown_core/ruby_multiline.rb, line 18
def self.is_ruby_multiline?(text)
  text && text.length > 1 && text[-1] == ',' &&
    !((text[-3, 2] =~ /\W\?/) || text[-3, 2] == '?\\')
end