Class: Mariner::Store
- Inherits:
-
Abyss::DeepStore
- Object
- Abyss::DeepStore
- Mariner::Store
- Defined in:
- lib/mariner/store.rb
Overview
Public: Uses the Abyss library to provide arbitrarily-deep sets of navigation groups / urls. Think of this as the group when defining nav trees.
Examples:
Mariner.configure do
a_group do # <= This effectivly creates a new Mariner::Store, ...
root_path "Home" # <= and this creates a new Mariner::Url within said store.
end
end
Instance Attribute Summary collapse
-
#virtual ⇒ Object
(also: #virtual?)
Public: If the group is virtual, the rendering strategy shouldn’t generate any output around its nested configurations when.
Instance Method Summary collapse
-
#assign(method_name, values) ⇒ Object
Public: Abstract method override - overrides ::Abyss::DeepStore#assign to store Urls.
-
#initialize ⇒ Store
constructor
Public: Sets virtual to false by default and defers to ::Abyss::DeepStore for initialization.
-
#render(rendering_strategy = ) ⇒ Object
Public: Uses a rendering strategy to render itself.
Constructor Details
#initialize ⇒ Store
Public: Sets virtual to false by default and defers to ::Abyss::DeepStore for initialization.
32 33 34 35 |
# File 'lib/mariner/store.rb', line 32 def initialize(*) @virtual = false super end |
Instance Attribute Details
#virtual ⇒ Object Also known as: virtual?
Public: If the group is virtual, the rendering strategy shouldn’t generate any output around its nested configurations when. e.g. The UnorderedListRenderer doesn’t generate ‘ul` or `li` tags when the target group is virtual.
26 27 28 |
# File 'lib/mariner/store.rb', line 26 def virtual @virtual end |
Instance Method Details
#assign(method_name, values) ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/mariner/store.rb', line 51 def assign(method_name, values) raise ArgumentError, "Wrong number of values specified (#{values.size} for <= 2)" if values.size > 2 values[1] ||= {} # link options title, = values self.configurations[method_name] = Url.new(method_name, title, ) end |
#render(rendering_strategy = ) ⇒ Object
Public: Uses a rendering strategy to render itself.
rendering_strategy - The rendering strategy to use when rendering.
Examples:
Mariner.configuration #=> An Mariner::Store instance
Mariner.configuration.render
Mariner.configuration.render(SomeRenderingStrategy.new)
70 71 72 |
# File 'lib/mariner/store.rb', line 70 def render(rendering_strategy=Mariner.rendering_strategies[:default]) rendering_strategy.factory(:group, self).render end |