Sha256: 4c86435f3ffcd61e5759e52f546243de07add55531056ea88840f4d07f9f422d

Contents?: true

Size: 697 Bytes

Versions: 18

Compression:

Stored size: 697 Bytes

Contents

module CC::Service::Helper
  GREEN_HEX = "#38ae6f".freeze
  RED_HEX = "#ed2f00".freeze

  def repo_name
    payload["repo_name"]
  end

  def details_url
    payload["details_url"]
  end

  def compare_url
    payload["compare_url"]
  end

  def emoji
    if improved?
      ":sunny:"
    else
      ":umbrella:"
    end
  end

  def color
    if improved?
      "green"
    else
      "red"
    end
  end

  def hex_color
    if improved?
      GREEN_HEX
    else
      RED_HEX
    end
  end

  def changed
    if improved?
      "improved"
    else
      "declined"
    end
  end

  def improved?
    raise NotImplementedError,
      "Event-specific helpers must define #{__method__}"
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
codeclimate-services-1.11.4 lib/cc/service/helper.rb
codeclimate-services-1.11.3 lib/cc/service/helper.rb
codeclimate-services-1.11.2 lib/cc/service/helper.rb
codeclimate-services-1.11.1 lib/cc/service/helper.rb
codeclimate-services-1.11.0 lib/cc/service/helper.rb
codeclimate-services-1.10.1 lib/cc/service/helper.rb
codeclimate-services-1.10.0 lib/cc/service/helper.rb
codeclimate-services-1.9.8 lib/cc/service/helper.rb
codeclimate-services-1.9.7 lib/cc/service/helper.rb
codeclimate-services-1.9.6 lib/cc/service/helper.rb
codeclimate-services-1.9.5 lib/cc/service/helper.rb
codeclimate-services-1.9.4 lib/cc/service/helper.rb
codeclimate-services-1.9.3 lib/cc/service/helper.rb
codeclimate-services-1.9.2 lib/cc/service/helper.rb
codeclimate-services-1.9.1 lib/cc/service/helper.rb
codeclimate-services-1.9.0 lib/cc/service/helper.rb
codeclimate-services-1.8.0 lib/cc/service/helper.rb
codeclimate-services-1.7.0 lib/cc/service/helper.rb