Class: Grape::DryTypes::ParamsCache
- Inherits:
-
Util::Cache
- Object
- Util::Cache
- Grape::DryTypes::ParamsCache
- Defined in:
- lib/grape/dry_types.rb
Constant Summary collapse
- MAPPING =
{ Grape::API::Boolean => DryTypes::Params::Bool, BigDecimal => DryTypes::Params::Decimal, Numeric => DryTypes::Params::Integer | DryTypes::Params::Float | DryTypes::Params::Decimal, TrueClass => DryTypes::Params::Bool.constrained(eql: true), FalseClass => DryTypes::Params::Bool.constrained(eql: false), String => DryTypes::Coercible::String }.freeze
Instance Attribute Summary
Attributes inherited from Util::Cache
Instance Method Summary collapse
-
#initialize ⇒ ParamsCache
constructor
A new instance of ParamsCache.
Constructor Details
#initialize ⇒ ParamsCache
Returns a new instance of ParamsCache.
38 39 40 41 42 43 44 45 |
# File 'lib/grape/dry_types.rb', line 38 def initialize super @cache = Hash.new do |h, params_type| h[params_type] = MAPPING.fetch(params_type) do DryTypes.wrapped_dry_types_const_get(DryTypes::Params, params_type) end end end |