Module: ViewComponentProps

Defined in:
lib/view_component_props.rb,
lib/view_component_props/errors.rb,
lib/view_component_props/casters.rb,
lib/view_component_props/railtie.rb,
lib/view_component_props/version.rb,
lib/view_component_props/definable.rb,
lib/view_component_props/definition.rb,
lib/view_component_props/casters/base.rb,
lib/view_component_props/configuration.rb

Defined Under Namespace

Modules: Casters, Definable, Initializer Classes: CastError, Configuration, Definition, Error, InvalidEnumValueError, Railtie, RequiredPropError, UnknownCastError, UnknownOptionError, UnknownPropsError, ValidationFailedError

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.configurationObject



7
8
9
# File 'lib/view_component_props/configuration.rb', line 7

def configuration
  @configuration ||= Configuration.new
end

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

Yields:



11
12
13
# File 'lib/view_component_props/configuration.rb', line 11

def configure
  yield(configuration)
end

.install!(target = ViewComponent::Base) ⇒ Object



24
25
26
27
28
29
# File 'lib/view_component_props.rb', line 24

def install!(target = ViewComponent::Base)
  return if target.include?(Definable)

  target.include(Definable)
  target.prepend(Initializer)
end

.reset_configuration!Object



15
16
17
18
# File 'lib/view_component_props/configuration.rb', line 15

def reset_configuration!
  @configuration = Configuration.new
  Casters.reset! if defined?(Casters)
end