Class: DNote::Format
- Inherits:
-
Object
- Object
- DNote::Format
- Defined in:
- lib/dnote/format.rb
Overview
Notes Formatter
–
TODO: Need good CSS file.
TODO: Need XSL?
++
Defined Under Namespace
Classes: ErbScope
Constant Summary collapse
- EXTENSIONS =
{"text" => "txt", "soap" => "xml", "xoxo" => "xml"}.freeze
Instance Attribute Summary collapse
-
#dryrun ⇒ Object
readonly
Returns the value of attribute dryrun.
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#notes ⇒ Object
readonly
Returns the value of attribute notes.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(notes, format: "text", title: "Developer's Notes", template: nil, output: nil, dryrun: false) ⇒ Format
constructor
A new instance of Format.
- #render ⇒ Object
Constructor Details
#initialize(notes, format: "text", title: "Developer's Notes", template: nil, output: nil, dryrun: false) ⇒ Format
Returns a new instance of Format.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dnote/format.rb', line 21 def initialize(notes, format: "text", title: "Developer's Notes", template: nil, output: nil, dryrun: false) @notes = notes @format = format @title = title @dryrun = dryrun @template = template @output = output end |
Instance Attribute Details
#dryrun ⇒ Object (readonly)
Returns the value of attribute dryrun.
19 20 21 |
# File 'lib/dnote/format.rb', line 19 def dryrun @dryrun end |
#format ⇒ Object (readonly)
Returns the value of attribute format.
19 20 21 |
# File 'lib/dnote/format.rb', line 19 def format @format end |
#notes ⇒ Object (readonly)
Returns the value of attribute notes.
19 20 21 |
# File 'lib/dnote/format.rb', line 19 def notes @notes end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
19 20 21 |
# File 'lib/dnote/format.rb', line 19 def output @output end |
#template ⇒ Object (readonly)
Returns the value of attribute template.
19 20 21 |
# File 'lib/dnote/format.rb', line 19 def template @template end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
19 20 21 |
# File 'lib/dnote/format.rb', line 19 def title @title end |
Instance Method Details
#render ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/dnote/format.rb', line 35 def render if notes.empty? $stderr << "No #{notes.labels.join(", ")} notes.\n" else case format when "custom" render_custom else render_template end end end |