Class: Codebot::Formatters::Public

Inherits:
Codebot::Formatter show all
Defined in:
lib/codebot/formatters/public.rb

Overview

This class formats public events.

Instance Attribute Summary

Attributes inherited from Codebot::Formatter

#payload

Instance Method Summary collapse

Methods inherited from Codebot::Formatter

#abbreviate, #action, #ary_to_sentence, #closed?, #extract, #format_branch, #format_dangerous, #format_event, #format_hash, #format_number, #format_repository, #format_url, #format_user, #gitlab_action, #gitlab_closed?, #gitlab_opened?, #gitlab_repository_url, #gitlab_url, #initialize, #opened?, #prettify, #repository_name, #repository_url, #sanitize, #sender_name, #shorten_url, #url

Constructor Details

This class inherits a constructor from Codebot::Formatter

Instance Method Details

#default_formatObject



21
22
23
# File 'lib/codebot/formatters/public.rb', line 21

def default_format
  '[%<repository>s] %<sender>s open-sourced the repository'
end

#formatArray<String>

Formats IRC messages for a public event.

Returns:

  • (Array<String>)

    the formatted messages



10
11
12
# File 'lib/codebot/formatters/public.rb', line 10

def format
  ["#{summary}: #{format_url url}"]
end

#summaryObject



14
15
16
17
18
19
# File 'lib/codebot/formatters/public.rb', line 14

def summary
  default_format % {
    repository: format_repository(repository_name),
    sender: format_user(sender_name)
  }
end

#summary_urlObject



25
26
27
# File 'lib/codebot/formatters/public.rb', line 25

def summary_url
  repository_url
end