Class: Deas::Kramdown::Source
- Inherits:
-
Object
- Object
- Deas::Kramdown::Source
- Defined in:
- lib/deas-kramdown/source.rb
Defined Under Namespace
Classes: NullCache
Instance Attribute Summary collapse
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
-
#doc_opts ⇒ Object
readonly
Returns the value of attribute doc_opts.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #compile(template_name, content) ⇒ Object
- #doc(content) ⇒ Object
-
#initialize(root, opts) ⇒ Source
constructor
A new instance of Source.
- #inspect ⇒ Object
- #render(template_name) ⇒ Object
Constructor Details
Instance Attribute Details
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
9 10 11 |
# File 'lib/deas-kramdown/source.rb', line 9 def cache @cache end |
#doc_opts ⇒ Object (readonly)
Returns the value of attribute doc_opts.
9 10 11 |
# File 'lib/deas-kramdown/source.rb', line 9 def doc_opts @doc_opts end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
9 10 11 |
# File 'lib/deas-kramdown/source.rb', line 9 def root @root end |
Instance Method Details
#compile(template_name, content) ⇒ Object
21 22 23 |
# File 'lib/deas-kramdown/source.rb', line 21 def compile(template_name, content) doc(content).to_html end |
#doc(content) ⇒ Object
25 26 27 |
# File 'lib/deas-kramdown/source.rb', line 25 def doc(content) Kramdown::Document.new(content, @doc_opts) end |
#inspect ⇒ Object
29 30 31 32 33 |
# File 'lib/deas-kramdown/source.rb', line 29 def inspect "#<#{self.class}:#{'0x0%x' % (object_id << 1)}"\ " @root=#{@root.inspect}"\ " @doc_opts=#{@doc_opts.inspect}>" end |
#render(template_name) ⇒ Object
17 18 19 |
# File 'lib/deas-kramdown/source.rb', line 17 def render(template_name) load(template_name).to_html end |