Class: Autodoc::Document
- Inherits:
-
Object
- Object
- Autodoc::Document
- Defined in:
- lib/autodoc/document.rb
Defined Under Namespace
Classes: Parameter
Class Method Summary collapse
Instance Method Summary collapse
- #identifier ⇒ Object
-
#initialize(context) ⇒ Document
constructor
A new instance of Document.
- #pathname ⇒ Object
- #render ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(context) ⇒ Document
Returns a new instance of Document.
14 15 16 |
# File 'lib/autodoc/document.rb', line 14 def initialize(context) @context = context end |
Class Method Details
.render(*args) ⇒ Object
10 11 12 |
# File 'lib/autodoc/document.rb', line 10 def self.render(*args) new(*args).render end |
Instance Method Details
#identifier ⇒ Object
33 34 35 |
# File 'lib/autodoc/document.rb', line 33 def identifier title.gsub(" ", "-").gsub(/[:\/]/, "").downcase end |
#pathname ⇒ Object
18 19 20 21 22 23 |
# File 'lib/autodoc/document.rb', line 18 def pathname @path ||= begin payload = @context.example.file_path.gsub(%r<\./spec/requests/(.+)_spec\.rb>, '\1.md') Pathname.new(Autodoc.configuration.path) + payload end end |
#render ⇒ Object
25 26 27 |
# File 'lib/autodoc/document.rb', line 25 def render ERB.new(Autodoc.configuration.template, nil, "-").result(binding) end |
#title ⇒ Object
29 30 31 |
# File 'lib/autodoc/document.rb', line 29 def title "#{method} #{path}" end |