Class: Beckett::Document
- Inherits:
-
Object
- Object
- Beckett::Document
- Defined in:
- lib/beckett.rb
Instance Method Summary collapse
-
#initialize(content) ⇒ Document
constructor
A new instance of Document.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(content) ⇒ Document
Returns a new instance of Document.
21 22 23 |
# File 'lib/beckett.rb', line 21 def initialize(content) @content = content end |
Instance Method Details
#to_hash ⇒ Object
25 26 27 28 29 |
# File 'lib/beckett.rb', line 25 def to_hash document = Kramdown::Document.new(@content, input: 'GFM') renderer = Renderer.send(:new, document.root) renderer.convert(document.root) end |
#to_json ⇒ Object
31 32 33 |
# File 'lib/beckett.rb', line 31 def to_json to_hash.to_json end |