class GitTopic::Formatter::Topics

summarizes topics information Topic means theme that not start to implement

Constants

LIST_TOPIC_COMMAND
Topic

Public Instance Methods

print() click to toggle source

Private Instance Methods

parse_topic(line) click to toggle source
# File lib/git_topic/formatter/topics.rb, line 41
def parse_topic(line)
  matched = line.match(/topic\.(?<topic_name>\S+)\s+(?<summary>.*)/)
  raise 'cannot parse topic' unless matched
  topic_name = matched[:topic_name]
  summary = matched[:summary]
  [topic_name, summary]
end
parse_topics() click to toggle source
# File lib/git_topic/formatter/topics.rb, line 31
def parse_topics
  topics = []
  _stdin, stdout, _stderr, _wait_thr = *Open3.popen3(LIST_TOPIC_COMMAND)
  stdout.each do |line|
    name, summary = parse_topic(line)
    topics << Topic.new(name, summary)
  end
  topics
end
print_contents(topics) click to toggle source
print_header() click to toggle source
print_line(topic) click to toggle source