Class: PointBlank::Parsing::IndentedBlock

Inherits:
NullParser
  • Object
show all
Defined in:
lib/mmmd/blankshell.rb

Overview

Indented code block

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from NullParser

#close, #initialize, #parsed_content

Constructor Details

This class inherits a constructor from PointBlank::Parsing::NullParser

Class Method Details

.begin?(line) ⇒ Boolean

Returns:

  • (Boolean)


766
767
768
# File 'lib/mmmd/blankshell.rb', line 766

def self.begin?(line)
  line.start_with?(/\A {4}/)
end

Instance Method Details

#consume(line, _parent = nil, **_hargs) ⇒ Array(String, Boolean)

Consume line markers

Parameters:

  • line (String)

Returns:

  • (Array(String, Boolean))


771
772
773
774
775
776
777
# File 'lib/mmmd/blankshell.rb', line 771

def consume(line, _parent = nil, **_hargs)
  return [nil, nil] unless self.class.begin?(line) ||
                           line.strip.empty?

  push(normalize(line))
  ["", false]
end