Module: Gretel
- Extended by:
- Resettable
- Defined in:
- lib/gretel.rb,
lib/gretel/link.rb,
lib/gretel/crumb.rb,
lib/gretel/crumbs.rb,
lib/gretel/railtie.rb,
lib/gretel/version.rb,
lib/gretel/renderer.rb,
lib/gretel/resettable.rb,
lib/gretel/view_helpers.rb,
lib/generators/gretel/install_generator.rb
Defined Under Namespace
Modules: Crumbs, Resettable, ViewHelpers Classes: Crumb, InstallGenerator, Link, Railtie, Renderer
Constant Summary collapse
- VERSION =
"5.0.1"
Class Attribute Summary collapse
-
.reload_environments ⇒ Object
Array of Rails environment names with automatic configuration reload.
Class Method Summary collapse
-
.breadcrumb_paths ⇒ Object
Returns the path from with breadcrumbs are loaded.
-
.breadcrumb_paths=(paths) ⇒ Object
Sets the path from with breadcrumbs are loaded.
-
.configure {|_self| ... } ⇒ Object
Yields this
Gretel
to be configured. -
.register_style(style, options) ⇒ Object
Registers a style for later use.
Methods included from Resettable
Class Attribute Details
.reload_environments ⇒ Object
Array of Rails environment names with automatic configuration reload. Default is [“development”].
32 33 34 |
# File 'lib/gretel.rb', line 32 def reload_environments @reload_environments ||= ["development"] end |
Class Method Details
.breadcrumb_paths ⇒ Object
Returns the path from with breadcrumbs are loaded. Default is config/breadcrumbs.rb
in the app and all loaded engines. Breadcrumbs set in the app will override breadcrumbs set in engines.
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/gretel.rb', line 12 def @breadcrumb_paths ||= begin engines = Rails::Engine.subclasses.map(&:instance) engine_roots = engines.map { |e| e.config.root } [*engine_roots, Rails.root].map do |root| [root.join("config", "breadcrumbs.rb"), root.join("config", "breadcrumbs", "**", "*.rb"), root.join("app", "views", "breadcrumbs", "**", "*.rb")] end.flatten end end |
.breadcrumb_paths=(paths) ⇒ Object
Sets the path from with breadcrumbs are loaded. Default is config/breadcrumbs.rb
.
27 28 29 |
# File 'lib/gretel.rb', line 27 def (paths) @breadcrumb_paths = paths end |
.configure {|_self| ... } ⇒ Object
Yields this Gretel
to be configured.
Gretel.configure do |config|
config.reload_environments << "staging"
end
51 52 53 |
# File 'lib/gretel.rb', line 51 def configure yield self end |
.register_style(style, options) ⇒ Object
Registers a style for later use.
Gretel.register_style :ul, { container_tag: :ul, fragment_tag: :li }
39 40 41 |
# File 'lib/gretel.rb', line 39 def register_style(style, ) Gretel::Renderer.register_style style, end |