Sha256: 4ea2e5c374203ebdabe01918fd08f79d26334dc14f882706f3cceba4a62dfe48

Contents?: true

Size: 502 Bytes

Versions: 4

Compression:

Stored size: 502 Bytes

Contents

module CC
  module Analyzer
    module IssueValidations
      class ContentValidation < Validation
        def valid?
          !has_content? || (content.is_a?(Hash) && content["body"].is_a?(String))
        end

        def message
          "Content must be a hash containing a 'body' key with string contents"
        end

        private

        def has_content?
          object.key?("content")
        end

        def content
          object["content"]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
codeclimate-0.36.0 lib/cc/analyzer/issue_validations/content_validation.rb
codeclimate-0.35.2 lib/cc/analyzer/issue_validations/content_validation.rb
codeclimate-0.35.1 lib/cc/analyzer/issue_validations/content_validation.rb
codeclimate-0.35.0 lib/cc/analyzer/issue_validations/content_validation.rb