Class: Vita::RenderingContext
- Inherits:
-
Object
- Object
- Vita::RenderingContext
- Includes:
- Html
- Defined in:
- lib/vita/rendering_context.rb
Instance Attribute Summary collapse
-
#note ⇒ Object
readonly
Returns the value of attribute note.
Instance Method Summary collapse
- #content_html ⇒ Object
- #garden ⇒ Object
- #get_binding ⇒ Object
-
#initialize(note) ⇒ RenderingContext
constructor
A new instance of RenderingContext.
- #link_to_note(note) ⇒ Object
Methods included from Html
Constructor Details
#initialize(note) ⇒ RenderingContext
Returns a new instance of RenderingContext.
9 10 11 |
# File 'lib/vita/rendering_context.rb', line 9 def initialize(note) @note = note end |
Instance Attribute Details
#note ⇒ Object (readonly)
Returns the value of attribute note.
7 8 9 |
# File 'lib/vita/rendering_context.rb', line 7 def note @note end |
Instance Method Details
#content_html ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/vita/rendering_context.rb', line 17 def content_html note.outlinks.reduce(note.html) { |html, link| html.sub( /(?<=\s)#{Regexp.quote(link.text)}\b/, link_to(link.text, link.to_note.path) ) } end |
#garden ⇒ Object
13 14 15 |
# File 'lib/vita/rendering_context.rb', line 13 def garden note.garden end |
#get_binding ⇒ Object
30 31 32 |
# File 'lib/vita/rendering_context.rb', line 30 def get_binding binding end |
#link_to_note(note) ⇒ Object
26 27 28 |
# File 'lib/vita/rendering_context.rb', line 26 def link_to_note(note) link_to note.title, note.path end |