Class: DebugMenu::Component

Inherits:
Lookbook::BaseComponent
  • Object
show all
Defined in:
app/components/lookbook/debug_menu/component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#featuresObject (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

Returns:

  • (Boolean)


13
14
15
# File 'app/components/lookbook/debug_menu/component.rb', line 13

def auto_refresh_enabled?
  feature(:auto_refresh, false)
end

#debug_dataObject



21
22
23
# File 'app/components/lookbook/debug_menu/component.rb', line 21

def debug_data
  content
end

#debug_data?Boolean

Returns:

  • (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