Class: ViewSpec::GroupPreview
Constant Summary
collapse
- PARTIAL_PATHS =
{
raw: "view_specs/group/raw",
source: "view_specs/group/source",
preview: "view_specs/group/preview"
}
Instance Method Summary
collapse
Methods inherited from Preview
#layout, #params, #render_in, #to_path, #to_url
Constructor Details
#initialize(entry, partial: nil, **options) ⇒ GroupPreview
Returns a new instance of GroupPreview.
9
10
11
12
|
# File 'lib/view_spec/group_preview.rb', line 9
def initialize(entry, partial: nil, **options)
@partial = partial
super(entry, **options)
end
|
Instance Method Details
#call(view_context = nil) ⇒ Object
Also known as:
to_s, to_str
14
15
16
|
# File 'lib/view_spec/group_preview.rb', line 14
def call(view_context = nil)
render_in_layout(:preview, view_context).html_safe
end
|
#lang ⇒ Object
27
28
29
|
# File 'lib/view_spec/group_preview.rb', line 27
def lang
@entry.scenarios&.first&.preview&.lang || :ruby
end
|
#raw(view_context = nil) ⇒ Object
18
19
20
21
|
# File 'lib/view_spec/group_preview.rb', line 18
def raw(view_context = nil)
html = render_in_layout(:raw, view_context)
CGI.unescapeHTML(html)
end
|
#source(view_context = nil) ⇒ Object
23
24
25
|
# File 'lib/view_spec/group_preview.rb', line 23
def source(view_context = nil)
render_in_layout(:source, view_context)
end
|