Module: Paramore::Validate
- Defined in:
- lib/paramore/validate.rb
Class Method Summary collapse
Class Method Details
.run(types_definition) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/paramore/validate.rb', line 5 def run(types_definition) types(types_definition).each do |type| unless type.respond_to?(Paramore.configuration.type_method_name) raise NoMethodError, "Paramore: type `#{type}` does not respond to " + "`#{Paramore.configuration.type_method_name}`!" end end end |
.types(types_definition) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/paramore/validate.rb', line 15 def types(types_definition) types_definition.flat_map do |param_name, paratype| unless paratype.is_a?(Paratype) raise Paramore::NonParatype.new(param_name, paratype) end paratype.type.is_a?(Hash) ? types(paratype.type) : paratype.type end.uniq end |