Class: Navigasmic::Builder::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/navigasmic/core/builder.rb

Direct Known Subclasses

CrumbBuilder, ListBuilder, MapBuilder

Defined Under Namespace

Classes: Configuration

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Base.

Raises:

  • (ArgumentError)


16
17
18
19
20
21
22
23
# File 'lib/navigasmic/core/builder.rb', line 16

def initialize(context, name, options, &block)
  @definition = block_given? ? block : Navigasmic.configuration.definitions[name]
  raise ArgumentError, "Missing block or configuration" unless @definition

  @context, @name, @options = context, name, options
  @config = configuration_or_default(@options.delete(:config))
  remove_excluded_options(@options)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object (private)



57
58
59
# File 'lib/navigasmic/core/builder.rb', line 57

def method_missing(meth, *args, &block)
  @context.send(meth, *args, &block)
end

Instance Method Details

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



25
26
27
# File 'lib/navigasmic/core/builder.rb', line 25

def group(label = nil, options = {}, &block)
  raise "Expected subclass to implement group"
end

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



29
30
31
# File 'lib/navigasmic/core/builder.rb', line 29

def item(label = nil, *args, &block)
  raise "Expected subclass to implement item"
end

#renderObject



33
34
35
# File 'lib/navigasmic/core/builder.rb', line 33

def render
  raise "Expected subclass to implement render"
end