Class: Markedly::Document
- Inherits:
-
Object
- Object
- Markedly::Document
- Defined in:
- lib/markedly/document.rb
Constant Summary collapse
- DEFAULT_PORT =
8080
Instance Attribute Summary collapse
-
#css ⇒ Object
readonly
Returns the value of attribute css.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #convert ⇒ Object
-
#initialize(source, options = {}) ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize(source, options = {}) ⇒ Document
Returns a new instance of Document.
18 19 20 21 22 23 24 25 26 |
# File 'lib/markedly/document.rb', line 18 def initialize(source, = {}) @source = File.(source) @path = File.basename(source) @port = [:port] || DEFAULT_PORT @markdown = Markdown.new([:parse], [:render]) initialize_template initialize_assets() initialize_destination end |
Instance Attribute Details
#css ⇒ Object (readonly)
Returns the value of attribute css.
15 16 17 |
# File 'lib/markedly/document.rb', line 15 def css @css end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
12 13 14 |
# File 'lib/markedly/document.rb', line 12 def destination @destination end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
13 14 15 |
# File 'lib/markedly/document.rb', line 13 def path @path end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
16 17 18 |
# File 'lib/markedly/document.rb', line 16 def port @port end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
11 12 13 |
# File 'lib/markedly/document.rb', line 11 def source @source end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
14 15 16 |
# File 'lib/markedly/document.rb', line 14 def uri @uri end |
Instance Method Details
#convert ⇒ Object
28 29 30 31 32 33 |
# File 'lib/markedly/document.rb', line 28 def convert @dest_file.rewind @dest_file.write render(body_html, @css, @port) @dest_file.truncate(@dest_file.pos) @dest_file.flush end |