Module: ViewComponentDevtools

Defined in:
lib/view_component_devtools.rb,
lib/view_component_devtools/state.rb,
lib/view_component_devtools/engine.rb,
lib/view_component_devtools/helper.rb,
lib/view_component_devtools/version.rb,
lib/view_component_devtools/component.rb,
lib/view_component_devtools/middleware.rb,
lib/view_component_devtools/normalizer.rb,
lib/view_component_devtools/subscriber.rb,
lib/view_component_devtools/configuration.rb

Defined Under Namespace

Modules: Component, Helper, State Classes: Configuration, Engine, Middleware, Normalizer, Subscriber

Constant Summary collapse

VERSION =
"0.1.7"

Class Method Summary collapse

Class Method Details

.capture_enabled?(environment = rails_environment) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/view_component_devtools.rb', line 18

def capture_enabled?(environment = rails_environment)
  configuration.enabled_for?(environment)
end

.configurationObject



10
11
12
# File 'lib/view_component_devtools.rb', line 10

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



14
15
16
# File 'lib/view_component_devtools.rb', line 14

def configure
  yield configuration
end

.development_environment?(environment = rails_environment) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/view_component_devtools.rb', line 22

def development_environment?(environment = rails_environment)
  environment.to_s == "development"
end

.validate_environment!(environment = rails_environment) ⇒ Object



26
27
28
29
30
# File 'lib/view_component_devtools.rb', line 26

def validate_environment!(environment = rails_environment)
  return unless configuration.enabled && !development_environment?(environment)

  raise "ViewComponent DevTools can only be enabled in development"
end