Class: Asuka::Rules::Header

Inherits:
Abstract show all
Defined in:
lib/asuka/rules.rb

Instance Attribute Summary

Attributes inherited from Abstract

#acc, #line_formatter, #result

Instance Method Summary collapse

Methods inherited from Abstract

#initialize, #transition

Constructor Details

This class inherits a constructor from Asuka::Rules::Abstract

Instance Method Details

#match?(line) ⇒ Boolean

Returns:

  • (Boolean)


96
97
98
# File 'lib/asuka/rules.rb', line 96

def match?(line)
  line =~ /^\#{1,6} /
end

#process(line) ⇒ Object



100
101
102
103
# File 'lib/asuka/rules.rb', line 100

def process(line)
  level = line[/^\#{1,6}/].size
  result << Asuka::Header.new(line_formatter.format(line[level+1..-1]), level)
end