Class: Grape::Validations::ParamsScope::Attr
- Inherits:
-
Object
- Object
- Grape::Validations::ParamsScope::Attr
- Defined in:
- lib/grape/validations/params_scope.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#scope ⇒ Object
Returns the value of attribute scope.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(key, scope) ⇒ Attr
constructor
Open up a new ParamsScope::Attr.
Constructor Details
#initialize(key, scope) ⇒ Attr
Open up a new ParamsScope::Attr
22 23 24 25 |
# File 'lib/grape/validations/params_scope.rb', line 22 def initialize(key, scope) @key = key @scope = scope end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
17 18 19 |
# File 'lib/grape/validations/params_scope.rb', line 17 def key @key end |
#scope ⇒ Object
Returns the value of attribute scope.
17 18 19 |
# File 'lib/grape/validations/params_scope.rb', line 17 def scope @scope end |
Class Method Details
.attr_key(declared_param_attr) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/grape/validations/params_scope.rb', line 34 def self.attr_key(declared_param_attr) return attr_key(declared_param_attr.key) if declared_param_attr.is_a?(self) if declared_param_attr.is_a?(Hash) declared_param_attr.transform_values { |value| attrs_keys(value) } else declared_param_attr end end |
.attrs_keys(declared_params) ⇒ Object
28 29 30 31 32 |
# File 'lib/grape/validations/params_scope.rb', line 28 def self.attrs_keys(declared_params) declared_params.map do |declared_param_attr| attr_key(declared_param_attr) end end |