Class: DebugMenu::Component
- Inherits:
-
Lookbook::BaseComponent
- Object
- Lookbook::BaseComponent
- DebugMenu::Component
- Defined in:
- app/components/lookbook/debug_menu/component.rb
Instance Attribute Summary collapse
-
#features ⇒ Object
readonly
Returns the value of attribute features.
Instance Method Summary collapse
- #auto_refresh_enabled? ⇒ Boolean
- #debug_data ⇒ Object
- #debug_data? ⇒ Boolean
- #feature(name, fallback = nil) ⇒ Object
-
#initialize(version: nil, docs_url: nil, repo_url: nil, features: {}, **html_attrs) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(version: nil, docs_url: nil, repo_url: nil, features: {}, **html_attrs) ⇒ Component
Returns a new instance of Component.
5 6 7 8 9 10 11 |
# File 'app/components/lookbook/debug_menu/component.rb', line 5 def initialize(version: nil, docs_url: nil, repo_url: nil, features: {}, **html_attrs) @version = version @docs_url = docs_url @repo_url = repo_url @features = features super(**html_attrs) end |
Instance Attribute Details
#features ⇒ Object (readonly)
Returns the value of attribute features.
3 4 5 |
# File 'app/components/lookbook/debug_menu/component.rb', line 3 def features @features end |
Instance Method Details
#auto_refresh_enabled? ⇒ Boolean
13 14 15 |
# File 'app/components/lookbook/debug_menu/component.rb', line 13 def auto_refresh_enabled? feature(:auto_refresh, false) end |
#debug_data ⇒ Object
21 22 23 |
# File 'app/components/lookbook/debug_menu/component.rb', line 21 def debug_data content end |
#debug_data? ⇒ Boolean
25 26 27 |
# File 'app/components/lookbook/debug_menu/component.rb', line 25 def debug_data? debug_data.present? end |
#feature(name, fallback = nil) ⇒ Object
17 18 19 |
# File 'app/components/lookbook/debug_menu/component.rb', line 17 def feature(name, fallback = nil) features.fetch(name.to_sym, fallback) end |