Sha256: 8b78547fcc03cc96db92ee739f1c9361433da345cd46aef269ee99aa5d6f3f74
Contents?: true
Size: 1.11 KB
Versions: 10
Compression:
Stored size: 1.11 KB
Contents
class Apipie::Generator::Swagger::WarningWriter include Singleton def initialize @issued_warnings = [] end # @param [Apipie::Generator::Swagger::Warning] warning def warn(warning) return if muted_warning?(warning) warning.warn @issued_warnings << warning.id end def issued_warnings? @issued_warnings.count > 0 end def clear! @issued_warnings = [] self end private # @param [Apipie::Generator::Swagger::Warning] warning # # @return [TrueClass, FalseClass] def muted_warning?(warning) @issued_warnings.include?(warning.id) || suppressed_warning?(warning.code) || suppress_warnings? end # @param [Integer] warning_number # # @return [TrueClass, FalseClass] def suppressed_warning?(warning_number) suppress_warnings_config.is_a?(Array) && suppress_warnings_config.include?(warning_number) end # @return [TrueClass, FalseClass] def suppress_warnings? suppress_warnings_config == true end # @return [FalseClass, TrueClass, Array] def suppress_warnings_config Apipie.configuration.generator.swagger.suppress_warnings end end
Version data entries
10 entries across 10 versions & 1 rubygems