Class: ViewSpec::Note
- Inherits:
-
Object
- Object
- ViewSpec::Note
- Defined in:
- lib/view_spec/note.rb
Instance Method Summary collapse
- #call(view_context = nil) ⇒ Object (also: #to_s, #to_str)
-
#initialize(entry, executable) ⇒ Note
constructor
A new instance of Note.
- #render_in(view_context) ⇒ Object
Constructor Details
#initialize(entry, executable) ⇒ Note
Returns a new instance of Note.
5 6 7 8 |
# File 'lib/view_spec/note.rb', line 5 def initialize(entry, executable) @entry = entry @executable = executable end |
Instance Method Details
#call(view_context = nil) ⇒ Object Also known as: to_s, to_str
10 11 12 13 14 15 16 |
# File 'lib/view_spec/note.rb', line 10 def call(view_context = nil) @rendered ||= begin text = renderer(view_context).render(renderable, assigns:, layout: false) output = (lang == :md) ? markdown.render(text) : text output.html_safe end end |
#render_in(view_context) ⇒ Object
18 19 20 |
# File 'lib/view_spec/note.rb', line 18 def render_in(view_context) call(view_context) end |