Module: DatGretel
- Extended by:
- Resettable
- Defined in:
- lib/dat_gretel.rb,
lib/dat_gretel/link.rb,
lib/dat_gretel/crumb.rb,
lib/dat_gretel/crumbs.rb,
lib/dat_gretel/version.rb,
lib/dat_gretel/renderer.rb,
lib/dat_gretel/resettable.rb,
lib/dat_gretel/view_helpers.rb,
lib/generators/dat_gretel/install_generator.rb
Defined Under Namespace
Modules: Crumbs, Resettable, ViewHelpers Classes: Crumb, InstallGenerator, Link, Renderer
Constant Summary collapse
- VERSION =
"4.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.
-
.show_deprecation_warning(message) ⇒ Object
Shows a deprecation warning.
-
.suppress_deprecation_warnings=(value) ⇒ Object
Sets whether to suppress deprecation warnings.
-
.suppress_deprecation_warnings? ⇒ Boolean
Whether to suppress deprecation warnings.
Methods included from Resettable
Class Attribute Details
.reload_environments ⇒ Object
Array of Rails environment names with automatic configuration reload. Default is [“development”].
57 58 59 |
# File 'lib/dat_gretel.rb', line 57 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.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dat_gretel.rb', line 17 def @breadcrumb_paths ||= begin engines = Rails::Engine::Railties.respond_to?(:engines) ? Rails::Engine::Railties.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
.
34 35 36 |
# File 'lib/dat_gretel.rb', line 34 def (paths) @breadcrumb_paths = paths end |
.configure {|_self| ... } ⇒ Object
Yields this Gretel
to be configured.
Gretel.configure do |config|
config.reload_environments << "staging"
end
76 77 78 |
# File 'lib/dat_gretel.rb', line 76 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 }
64 65 66 |
# File 'lib/dat_gretel.rb', line 64 def register_style(style, ) DatGretel::Renderer.register_style style, end |
.show_deprecation_warning(message) ⇒ Object
Shows a deprecation warning.
49 50 51 52 53 54 |
# File 'lib/dat_gretel.rb', line 49 def show_deprecation_warning() return if suppress_deprecation_warnings? = "[Gretel] #{}" puts Rails.logger.warn end |
.suppress_deprecation_warnings=(value) ⇒ Object
Sets whether to suppress deprecation warnings.
44 45 46 |
# File 'lib/dat_gretel.rb', line 44 def suppress_deprecation_warnings=(value) @suppress_deprecation_warnings = value end |
.suppress_deprecation_warnings? ⇒ Boolean
Whether to suppress deprecation warnings.
39 40 41 |
# File 'lib/dat_gretel.rb', line 39 def suppress_deprecation_warnings? !!@suppress_deprecation_warnings if defined? @suppress_deprecation_warnings end |