Class: ViewComponentProps::Configuration
- Inherits:
-
Object
- Object
- ViewComponentProps::Configuration
- Defined in:
- lib/view_component_props/configuration.rb
Instance Attribute Summary collapse
-
#auto_include ⇒ Object
Returns the value of attribute auto_include.
-
#custom_casters ⇒ Object
readonly
Returns the value of attribute custom_casters.
-
#reject_undefined_props ⇒ Object
Returns the value of attribute reject_undefined_props.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #register_caster(key, &block) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
26 27 28 29 30 |
# File 'lib/view_component_props/configuration.rb', line 26 def initialize @auto_include = true @reject_undefined_props = false @custom_casters = HashWithIndifferentAccess.new end |
Instance Attribute Details
#auto_include ⇒ Object
Returns the value of attribute auto_include.
22 23 24 |
# File 'lib/view_component_props/configuration.rb', line 22 def auto_include @auto_include end |
#custom_casters ⇒ Object (readonly)
Returns the value of attribute custom_casters.
24 25 26 |
# File 'lib/view_component_props/configuration.rb', line 24 def custom_casters @custom_casters end |
#reject_undefined_props ⇒ Object
Returns the value of attribute reject_undefined_props.
23 24 25 |
# File 'lib/view_component_props/configuration.rb', line 23 def reject_undefined_props @reject_undefined_props end |
Instance Method Details
#register_caster(key, &block) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/view_component_props/configuration.rb', line 32 def register_caster(key, &block) raise ArgumentError, "register_caster requires a block" unless block custom_casters[key] = block Casters.registry[key] = block if defined?(Casters) end |