Class: Quarry::Markup::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/quarry/markup/header.rb

Overview

Header

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec, text, lineno) ⇒ Header

Returns a new instance of Header.



13
14
15
16
17
# File 'lib/quarry/markup/header.rb', line 13

def initialize(spec, text, lineno)
  @parent = spec
  @text   = text.strip
  @lineno = lineno
end

Instance Attribute Details

#linenoObject (readonly)

Returns the value of attribute lineno.



11
12
13
# File 'lib/quarry/markup/header.rb', line 11

def lineno
  @lineno
end

#specObject (readonly) Also known as: parent

Returns the value of attribute spec.



9
10
11
# File 'lib/quarry/markup/header.rb', line 9

def spec
  @spec
end

#textObject (readonly) Also known as: description

Returns the value of attribute text.



10
11
12
# File 'lib/quarry/markup/header.rb', line 10

def text
  @text
end

Instance Method Details

#run(runner, spec, context, output) ⇒ Object

“run” comment.



23
24
25
# File 'lib/quarry/markup/header.rb', line 23

def run(runner, spec, context, output)
  output.report_header(self)
end

#to_sObject



28
29
30
# File 'lib/quarry/markup/header.rb', line 28

def to_s
  text.to_s
end

#to_scriptObject

As would appear in stand-alone script.



33
34
35
# File 'lib/quarry/markup/header.rb', line 33

def to_script
  text.to_s.gsub(/^/m, '# ')
end