Sha256: 1526f557b7de71664985c6022279fe28da9654fa2f4ad6f2651a83bf89e79f7c

Contents?: true

Size: 686 Bytes

Versions: 20

Compression:

Stored size: 686 Bytes

Contents

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

  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

20 entries across 20 versions & 1 rubygems

Version Path
codeclimate-services-1.6.1 lib/cc/service/helper.rb
codeclimate-services-1.6.0 lib/cc/service/helper.rb
codeclimate-services-1.5.1 lib/cc/service/helper.rb
codeclimate-services-1.5.0 lib/cc/service/helper.rb
codeclimate-services-1.4.0 lib/cc/service/helper.rb
codeclimate-services-1.3.0 lib/cc/service/helper.rb
codeclimate-services-1.2.0 lib/cc/service/helper.rb
codeclimate-services-1.1.0 lib/cc/service/helper.rb
codeclimate-services-1.0.1 lib/cc/service/helper.rb
codeclimate-services-1.0.0 lib/cc/service/helper.rb
codeclimate-services-0.6.2 lib/cc/service/helper.rb
codeclimate-services-0.6.1 lib/cc/service/helper.rb
codeclimate-services-0.6.0 lib/cc/service/helper.rb
codeclimate-services-0.5.3 lib/cc/service/helper.rb
codeclimate-services-0.5.2 lib/cc/service/helper.rb
codeclimate-services-0.5.1 lib/cc/service/helper.rb
codeclimate-services-0.5.0 lib/cc/service/helper.rb
codeclimate-services-0.4.1 lib/cc/service/helper.rb
codeclimate-services-0.4.0 lib/cc/service/helper.rb
codeclimate-services-0.3.0 lib/cc/service/helper.rb