Module: Respect::DocHelper

Included in:
Schema
Defined in:
lib/respect/doc_helper.rb

Overview

Convenient module to ease usage of DocParser.

Include it in classes returning their documentation via a documentation method. This module provides a #title and #description methods for extracting them from the documentation.

Instance Method Summary (collapse)

Instance Method Details

- (Object) description

Returns the description part of the documentation returned by documentation method (nil if it does not have any).



18
19
20
21
22
# File 'lib/respect/doc_helper.rb', line 18

def description
  if documentation
    DocParser.new.parse(documentation.to_s).description
  end
end

- (Object) title

Returns the title part of the documentation returned by documentation method (nil if it does not have any).



10
11
12
13
14
# File 'lib/respect/doc_helper.rb', line 10

def title
  if documentation
    DocParser.new.parse(documentation.to_s).title
  end
end