Module: Pronto::Formatter
- Defined in:
- lib/pronto/formatter/base.rb,
lib/pronto/formatter/formatter.rb,
lib/pronto/formatter/colorizable.rb,
lib/pronto/formatter/git_formatter.rb,
lib/pronto/formatter/json_formatter.rb,
lib/pronto/formatter/null_formatter.rb,
lib/pronto/formatter/text_formatter.rb,
lib/pronto/formatter/commit_formatter.rb,
lib/pronto/formatter/github_formatter.rb,
lib/pronto/formatter/gitlab_formatter.rb,
lib/pronto/formatter/bitbucket_formatter.rb,
lib/pronto/formatter/checkstyle_formatter.rb,
lib/pronto/formatter/pull_request_formatter.rb,
lib/pronto/formatter/text_message_decorator.rb,
lib/pronto/formatter/github_status_formatter.rb,
lib/pronto/formatter/github_pull_request_formatter.rb,
lib/pronto/formatter/bitbucket_pull_request_formatter.rb,
lib/pronto/formatter/github_combined_status_formatter.rb,
lib/pronto/formatter/github_status_formatter/sentence.rb,
lib/pronto/formatter/github_pull_request_review_formatter.rb,
lib/pronto/formatter/gitlab_merge_request_review_formatter.rb,
lib/pronto/formatter/github_status_formatter/status_builder.rb,
lib/pronto/formatter/bitbucket_server_pull_request_formatter.rb
Defined Under Namespace
Modules: Colorizable
Classes: Base, BitbucketFormatter, BitbucketPullRequestFormatter, BitbucketServerPullRequestFormatter, CheckstyleFormatter, CommitFormatter, GitFormatter, GithubCombinedStatusFormatter, GithubFormatter, GithubPullRequestFormatter, GithubPullRequestReviewFormatter, GithubStatusFormatter, GitlabFormatter, GitlabMergeRequestReviewFormatter, JsonFormatter, NullFormatter, PullRequestFormatter, TextFormatter, TextMessageDecorator
Class Method Summary
collapse
Class Method Details
.get(names) ⇒ Object
16
17
18
19
20
|
# File 'lib/pronto/formatter/formatter.rb', line 16
def get(names)
names ||= 'text'
Array(names).map { |name| @formatters[name.to_s] || TextFormatter }
.uniq.map(&:new)
end
|
.names ⇒ Object
22
23
24
|
# File 'lib/pronto/formatter/formatter.rb', line 22
def names
@formatters.keys
end
|
.register(formatter_klass) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/pronto/formatter/formatter.rb', line 4
def register(formatter_klass)
unless formatter_klass.method_defined?(:format)
raise NoMethodError, "format method is not declared in the #{formatter_klass.name} class."
end
base = Pronto::Formatter::Base
raise "#{formatter_klass.name} is not a #{base}" unless formatter_klass.ancestors.include?(base)
@formatters ||= {}
@formatters[formatter_klass.name] = formatter_klass
end
|