Class: Gretel::Renderer::Base
- Inherits:
-
Object
- Object
- Gretel::Renderer::Base
show all
- Defined in:
- lib/gretel/renderer.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(context, options) ⇒ Base
Returns a new instance of Base.
230
231
232
233
|
# File 'lib/gretel/renderer.rb', line 230
def initialize(context, options)
@context = context
@options = options
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
284
285
286
|
# File 'lib/gretel/renderer.rb', line 284
def method_missing(method, *args, &block)
context.send(method, *args, &block)
end
|
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
228
229
230
|
# File 'lib/gretel/renderer.rb', line 228
def context
@context
end
|
#options ⇒ Object
Returns the value of attribute options.
228
229
230
|
# File 'lib/gretel/renderer.rb', line 228
def options
@options
end
|
Instance Method Details
#render_container(html) ⇒ Object
248
249
|
# File 'lib/gretel/renderer.rb', line 248
def render_container(html)
end
|
#render_current_fragment(link, position) ⇒ Object
239
240
241
242
243
|
# File 'lib/gretel/renderer.rb', line 239
def render_current_fragment(link, position)
url = options[:link_current] ? link.url : nil
opts = fragment_options.merge(class: options[:current_class], current_link: link.url, aria_current: options[:aria_current])
render_fragment_tag(fragment_tag, link.text, url, position, **opts)
end
|
#render_fragment(link, position) ⇒ Object
235
236
237
|
# File 'lib/gretel/renderer.rb', line 235
def render_fragment(link, position)
render_fragment_tag(fragment_tag, link.text, link.url, position, **fragment_options)
end
|
#render_fragment_tag(fragment_tag, text, url, position, options = {}) ⇒ Object
245
246
|
# File 'lib/gretel/renderer.rb', line 245
def render_fragment_tag(fragment_tag, text, url, position, options = {})
end
|
#render_posttext ⇒ Object
257
258
259
260
261
|
# File 'lib/gretel/renderer.rb', line 257
def render_posttext
if options[:posttext].present?
content_tag(:span, options[:posttext], class: options[:posttext_class])
end
end
|
#render_pretext ⇒ Object
251
252
253
254
255
|
# File 'lib/gretel/renderer.rb', line 251
def render_pretext
if options[:pretext].present?
content_tag(:span, options[:pretext], class: options[:pretext_class])
end
end
|