Class: Avo::Concerns::Breadcrumbs::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/avo/concerns/breadcrumbs.rb

Constant Summary collapse

DEFAULT_SEPARATOR =
" » ".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, options) ⇒ Builder

Returns a new instance of Builder.



27
28
29
30
# File 'lib/avo/concerns/breadcrumbs.rb', line 27

def initialize(context, options)
  @context = context
  @options = options
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



25
26
27
# File 'lib/avo/concerns/breadcrumbs.rb', line 25

def context
  @context
end

#optionsObject (readonly)

Returns the value of attribute options.



25
26
27
# File 'lib/avo/concerns/breadcrumbs.rb', line 25

def options
  @options
end

Instance Method Details

#renderObject



32
33
34
35
# File 'lib/avo/concerns/breadcrumbs.rb', line 32

def render
  separator = options.fetch(:separator, DEFAULT_SEPARATOR)
  breadcrumbs.map(&method(:render_element)).join(separator)
end