Sha256: 9ef4ff3143c556aad2ca25ba5db09f2271aa9644c133a19318a5cd20082bce71

Contents?: true

Size: 840 Bytes

Versions: 4

Compression:

Stored size: 840 Bytes

Contents

require 'term/ansicolor'

module GherkinLint
  # entity value class for issues
  class Issue
    include Term::ANSIColor
    attr_reader :name, :references, :description

    def initialize(name, references, description = nil)
      @name = name
      @references = references
      @description = description
    end
  end

  # entity value class for errors
  class Error < Issue
    def render
      result = red(@name)
      result += " - #{@description}" unless @description.nil?
      result += "\n  " + green(@references.uniq * "\n  ")
      result
    end
  end

  # entity value class for warnings
  class Warning < Issue
    def render
      result = "#{yellow(@name)} (Warning)"
      result += " - #{@description}" unless @description.nil?
      result += "\n  " + green(@references.uniq * "\n  ")
      result
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gherkin_lint-1.2.2 lib/gherkin_lint/issue.rb
gherkin_lint-1.2.1 lib/gherkin_lint/issue.rb
gherkin_lint-1.1.0 lib/gherkin_lint/issue.rb
gherkin_lint-1.0.0 lib/gherkin_lint/issue.rb