Module: Ore::Template::Helpers::RDoc

Defined in:
lib/ore/template/helpers/rdoc.rb

Overview

Since:

  • 0.10.0

Instance Method Summary collapse

Instance Method Details

#h1(title) ⇒ String

Emits a RDoc h1 heading.

Parameters:

  • title (String)

Returns:

  • (String)

Since:

  • 0.10.0


43
44
45
# File 'lib/ore/template/helpers/rdoc.rb', line 43

def h1(title)
  "= #{title}"
end

#h2(title) ⇒ String

Emits a RDoc h2 heading.

Parameters:

  • title (String)

Returns:

  • (String)

Since:

  • 0.10.0


54
55
56
# File 'lib/ore/template/helpers/rdoc.rb', line 54

def h2(title)
  "== #{title}"
end

#h3(title) ⇒ String

Emits a RDoc h3 heading.

Parameters:

  • title (String)

Returns:

  • (String)

Since:

  • 0.10.0


65
66
67
# File 'lib/ore/template/helpers/rdoc.rb', line 65

def h3(title)
  "=== #{title}"
end

#h4(title) ⇒ String

Emits a RDoc h4 heading.

Parameters:

  • title (String)

Returns:

  • (String)

Since:

  • 0.10.0


76
77
78
# File 'lib/ore/template/helpers/rdoc.rb', line 76

def h4(title)
  "==== #{title}"
end

#image(url, alt = nil) ⇒ String

Emits a RDoc image.

Parameters:

  • url (String)
  • alt (String, nil) (defaults to: nil)

Returns:

  • (String)

Since:

  • 0.10.0


32
33
34
# File 'lib/ore/template/helpers/rdoc.rb', line 32

def image(url,alt=nil)
  "{#{alt}}[rdoc-image:#{url}]"
end

Emits a RDoc link.

Parameters:

  • text (String, nil)
  • url (String)

Returns:

  • (String)

Since:

  • 0.10.0


19
20
21
# File 'lib/ore/template/helpers/rdoc.rb', line 19

def link_to(text,url)
  "{#{text}}[#{url}]"
end

#pre(code) { ... } ⇒ String

Emits a RDoc code block.

Parameters:

  • code (String)

Yields:

  • [] The return value of the given block will be used as the code.

Returns:

  • (String)

Since:

  • 0.10.0


90
91
92
# File 'lib/ore/template/helpers/rdoc.rb', line 90

def pre(code)
  code.each_line.map { |line| "  #{line}" }.join
end