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, example) ⇒ Document
constructor
A new instance of Document.
- #pathname ⇒ Object
- #render ⇒ Object
- #title ⇒ Object
Constructor Details
#initialize(context, example) ⇒ Document
Returns a new instance of Document.
14 15 16 17 |
# File 'lib/autodoc/document.rb', line 14 def initialize(context, example) @context = context @example = example 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
34 35 36 |
# File 'lib/autodoc/document.rb', line 34 def identifier title.gsub(" ", "-").gsub(/[:\/]/, "").downcase end |
#pathname ⇒ Object
19 20 21 22 23 24 |
# File 'lib/autodoc/document.rb', line 19 def pathname @path ||= begin payload = example.file_path.gsub(%r<\./spec/requests/(.+)_spec\.rb>, '\1.md') Autodoc.configuration.pathname + payload end end |
#render ⇒ Object
26 27 28 |
# File 'lib/autodoc/document.rb', line 26 def render ERB.new(Autodoc.configuration.template, nil, "-").result(binding) end |
#title ⇒ Object
30 31 32 |
# File 'lib/autodoc/document.rb', line 30 def title "#{method} #{path}" end |