Module: Hoe::Halostatue::ParseUrls

Defined in:
lib/hoe/halostatue.rb

Constant Summary collapse

URLS_TO_META_MAP =
{
  "changelog" => "changelog_uri",
  "changes" => "changelog_uri",
  "documentation" => "documentation_uri",
  "history" => "changelog_uri",
  "issues" => "bug_tracker_uri",
  "tickets" => "bug_tracker_uri"
}

Instance Method Summary collapse

Instance Method Details

#parse_urls(text) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/hoe/halostatue.rb', line 52

def parse_urls text
  lines = text.gsub(/^[-*] /, "").delete("<>").split("\n").grep(/\S+/)

  return {} if lines.empty?

  if /::/.match?(lines.first)
    Hash[lines.map { |line| line.split(/\s*::\s*/) }]
  else
    {}
  end
end