Sha256: 124acb7eba9e75b37d5d7a9a347a699ffb542653e3f0602872bdbaae1a60a9dc

Contents?: true

Size: 541 Bytes

Versions: 15

Compression:

Stored size: 541 Bytes

Contents

require "delegate"

class CC::Service::Formatter < SimpleDelegator
  attr_reader :options

  def initialize(service, options = {})
    super(service)

    @options = {
      prefix: "[Code Climate]",
      prefix_with_repo: true,
    }.merge(options)
  end

  private

  def service_title
    __getobj__.class.title
  end

  def message_prefix
    prefix = options.fetch(:prefix, "").to_s

    if options[:prefix_with_repo]
      prefix << "[#{repo_name}]"
    end

    unless prefix.empty?
      prefix << " "
    end

    prefix
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

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