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.
229
230
231
232
|
# File 'lib/gretel/renderer.rb', line 229
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
283
284
285
|
# File 'lib/gretel/renderer.rb', line 283
def method_missing(method, *args, &block)
context.send(method, *args, &block)
end
|
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
227
228
229
|
# File 'lib/gretel/renderer.rb', line 227
def context
@context
end
|
#options ⇒ Object
Returns the value of attribute options.
227
228
229
|
# File 'lib/gretel/renderer.rb', line 227
def options
@options
end
|
Instance Method Details
#render_container(html) ⇒ Object
247
248
|
# File 'lib/gretel/renderer.rb', line 247
def render_container(html)
end
|
#render_current_fragment(link, position) ⇒ Object
238
239
240
241
242
|
# File 'lib/gretel/renderer.rb', line 238
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
234
235
236
|
# File 'lib/gretel/renderer.rb', line 234
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
244
245
|
# File 'lib/gretel/renderer.rb', line 244
def render_fragment_tag(fragment_tag, text, url, position, options = {})
end
|
#render_posttext ⇒ Object
256
257
258
259
260
|
# File 'lib/gretel/renderer.rb', line 256
def render_posttext
if options[:posttext].present?
content_tag(:span, options[:posttext], class: options[:posttext_class])
end
end
|
#render_pretext ⇒ Object
250
251
252
253
254
|
# File 'lib/gretel/renderer.rb', line 250
def render_pretext
if options[:pretext].present?
content_tag(:span, options[:pretext], class: options[:pretext_class])
end
end
|