Module: StructuredParams
- Defined in:
- lib/structured_params.rb,
lib/structured_params/i18n.rb,
lib/structured_params/errors.rb,
lib/structured_params/params.rb,
lib/structured_params/version.rb,
lib/structured_params/type/array.rb,
lib/structured_params/type/object.rb,
lib/structured_params/validations.rb,
lib/structured_params/attribute_methods.rb
Overview
rbs_inline: enabled frozen_string_literal: true
Defined Under Namespace
Modules: AttributeMethods, I18n, Type, Validations Classes: Configuration, Errors, Params
Constant Summary collapse
- VERSION =
: string
'0.9.4'
Class Method Summary collapse
-
.configuration ⇒ Object
: () -> Configuration.
-
.configure {|configuration| ... } ⇒ Object
: () { (Configuration) -> void } -> void.
-
.register_types ⇒ Object
Helper method to register types : () -> void.
-
.register_types_as(object_name:, array_name:) ⇒ Object
Helper method to register types with custom names : (object_name: Symbol, array_name: Symbol) -> void.
-
.reset_configuration! ⇒ Object
: () -> void.
Class Method Details
.configuration ⇒ Object
: () -> Configuration
69 70 71 |
# File 'lib/structured_params.rb', line 69 def configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
: () { (Configuration) -> void } -> void
74 75 76 |
# File 'lib/structured_params.rb', line 74 def configure yield configuration end |
.register_types ⇒ Object
Helper method to register types : () -> void
85 86 87 88 |
# File 'lib/structured_params.rb', line 85 def register_types ActiveModel::Type.register(:object, StructuredParams::Type::Object) ActiveModel::Type.register(:array, StructuredParams::Type::Array) end |
.register_types_as(object_name:, array_name:) ⇒ Object
Helper method to register types with custom names : (object_name: Symbol, array_name: Symbol) -> void
92 93 94 95 |
# File 'lib/structured_params.rb', line 92 def register_types_as(object_name:, array_name:) ActiveModel::Type.register(object_name, StructuredParams::Type::Object) ActiveModel::Type.register(array_name, StructuredParams::Type::Array) end |
.reset_configuration! ⇒ Object
: () -> void
79 80 81 |
# File 'lib/structured_params.rb', line 79 def reset_configuration! @configuration = Configuration.new end |