Class: Grape::Validations::Types::JsonArray
- Defined in:
 - lib/grape/validations/types/json.rb
 
Overview
Specialization of the Json attribute that is guaranteed to return an array of objects. Accepts both JSON-encoded objects and arrays of objects, but wraps single objects in an Array.
Instance Method Summary collapse
- #coerce(input) ⇒ Array<Hash>
 - 
  
    
      #value_coerced?(value)  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    
See Grape::Validations::Types::Json#coerced_collection?.
 
Instance Method Details
#coerce(input) ⇒ Array<Hash>
See Grape::Validations::Types::Json#coerce. Wraps single objects in an array.
      53 54 55 56  | 
    
      # File 'lib/grape/validations/types/json.rb', line 53 def coerce(input) json = super Array.wrap(json) unless json.nil? end  | 
  
#value_coerced?(value) ⇒ Boolean
See Grape::Validations::Types::Json#coerced_collection?
      59 60 61  | 
    
      # File 'lib/grape/validations/types/json.rb', line 59 def value_coerced?(value) coerced_collection? value end  |