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
24 25 26 27 |
# File 'lib/grape/validations/params_scope.rb', line 24 def initialize(key, scope) @key = key @scope = scope end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
19 20 21 |
# File 'lib/grape/validations/params_scope.rb', line 19 def key @key end |
#scope ⇒ Object
Returns the value of attribute scope.
19 20 21 |
# File 'lib/grape/validations/params_scope.rb', line 19 def scope @scope end |
Class Method Details
.attr_key(declared_param_attr) ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/grape/validations/params_scope.rb', line 36 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
30 31 32 33 34 |
# File 'lib/grape/validations/params_scope.rb', line 30 def self.attrs_keys(declared_params) declared_params.map do |declared_param_attr| attr_key(declared_param_attr) end end |