Class: Navigasmic::Builder::MapBuilder

Inherits:
Base
  • Object
show all
Defined in:
lib/navigasmic/builders/map_builder.rb

Defined Under Namespace

Classes: Configuration

Instance Method Summary collapse

Constructor Details

#initialize(context, name, options, &block) ⇒ MapBuilder

Returns a new instance of MapBuilder.


31
32
33
34
35
36
37
# File 'lib/navigasmic/builders/map_builder.rb', line 31

def initialize(context, name, options, &block)
  super
  @options['xmlns'] ||= @config.xmlns
  @options['xmlns:xsi'] ||= @config.xmlns_xsi
  @options['xsi:schemaLocation'] ||= @config.schema_location
  @options[:changefreq] ||= @config.changefreq
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Navigasmic::Builder::Base

Instance Method Details

#group(label = nil, options = {}, &block) ⇒ Object

Raises:

  • (ArgumentError)

43
44
45
46
47
48
# File 'lib/navigasmic/builders/map_builder.rb', line 43

def group(label = nil, options = {}, &block)
  raise ArgumentError, "Missing block for group" unless block_given?
  return '' unless visible?(options)

  concat(capture(&block))
end

#item(label, *args, &block) ⇒ Object


50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/navigasmic/builders/map_builder.rb', line 50

def item(label, *args, &block)
  options = args.extract_options!
  options = flatten_and_eval_options(options)
  return '' unless visible?(options)

  item = Navigasmic::Item.new(label, extract_and_determine_link(label, options, *args), visible?(options), options)

  concat(capture(&block)) if block_given?
  return '' unless item.link?

  concat(structure_for(label, item.link, options))
end

#renderObject


39
40
41
# File 'lib/navigasmic/builders/map_builder.rb', line 39

def render
  (@config.wrapper_tag, capture(&@definition), @options)
end