Module: Ariane
- Defined in:
- lib/ariane.rb,
lib/ariane/crumb.rb,
lib/ariane/version.rb,
lib/ariane/breadcrumb.rb,
lib/ariane/render/base.rb,
lib/ariane/render/html.rb,
lib/ariane/render/html_list.rb,
lib/ariane/rails/view_helper.rb,
lib/ariane/rails/controller_helper.rb
Defined Under Namespace
Modules: ControllerHelper, Render, ViewHelper Classes: Breadcrumb, Crumb
Constant Summary collapse
- VERSION =
Public: String version of the Ariane gem.
"0.0.3"
Class Attribute Summary collapse
-
.request ⇒ Object
Internal: Gets the request id.
Class Method Summary collapse
-
.breadcrumb ⇒ Object
Internal: Gets the Breadcrumb.
-
.breadcrumb=(breadcrumb) ⇒ Object
Internal: Sets the Breadcrumb.
-
.configure {|_self| ... } ⇒ Object
Public: Provides a simple way to access Ariane configuration.
-
.default_renderer ⇒ Object
Public: Returns the default renderer used by Ariane.
-
.default_renderer=(renderer) ⇒ Object
Public: Sets the default renderer used by Ariane.
-
.request_env ⇒ Object
Internal: Gets the request environment.
-
.request_env=(environment) ⇒ Object
Internal: Sets the request environment.
Class Attribute Details
.request ⇒ Object
Internal: Gets the request id.
Returns the current request id.
48 49 50 |
# File 'lib/ariane.rb', line 48 def request @request end |
Class Method Details
.breadcrumb ⇒ Object
Internal: Gets the Breadcrumb.
Returns a Breadcrumb.
64 65 66 |
# File 'lib/ariane.rb', line 64 def @request_env[:breadcrumb] end |
.breadcrumb=(breadcrumb) ⇒ Object
Internal: Sets the Breadcrumb.
Returns nothing.
71 72 73 |
# File 'lib/ariane.rb', line 71 def () @request_env[:breadcrumb] = end |
.configure {|_self| ... } ⇒ Object
Public: Provides a simple way to access Ariane configuration.
Yields self.
Examples
Ariane.configure do |config|
config.default_renderer = SomeRendererClass
end
Returns nothing.
23 24 25 |
# File 'lib/ariane.rb', line 23 def configure yield self end |
.default_renderer ⇒ Object
Public: Returns the default renderer used by Ariane.
If the default renderer hasn’t been set yeat, it will be set as a new Ariane::Render::HTMLList instance.
Examples
Ariane.default_renderer
# => #<Ariane::Render::HTMLList ...>
Returns the default renderer.
86 87 88 |
# File 'lib/ariane.rb', line 86 def default_renderer @default_renderer ||= Ariane::Render::HTMLList.new end |
.default_renderer=(renderer) ⇒ Object
Public: Sets the default renderer used by Ariane.
renderer - An instance or a class that will be used as default renderer
by Ariane. If a class is given the default renderer will be set
to a new instance of this class.
Examples
Ariane.default_renderer = SomeRendererClass.new
Ariane.default_renderer = SomeRendererClass
Ariane.default_renderer
# => #<SomeRendererClass ...>
Returns the default renderer.
105 106 107 |
# File 'lib/ariane.rb', line 105 def default_renderer=(renderer) @default_renderer = renderer.is_a?(Class) ? renderer.new : renderer end |
.request_env ⇒ Object
Internal: Gets the request environment.
Returns a Hash containing the request environment.
41 42 43 |
# File 'lib/ariane.rb', line 41 def request_env @request_env if defined?(@request_env) end |
.request_env=(environment) ⇒ Object
Internal: Sets the request environment.
If the :breadcrumb key is not present in the environment, it will be set to a new instance of Breadcrumb.
Returns nothing.
33 34 35 36 |
# File 'lib/ariane.rb', line 33 def request_env=(environment) @request_env = environment @request_env[:breadcrumb] ||= Breadcrumb.new end |