class PrLog::Gemspec

Extract default configuration from a gem specification

Public Instance Methods

github_repository() click to toggle source
# File lib/pr_log/gemspec.rb, line 6
def github_repository
  unless specification.homepage =~ %r{https?://github.com/}
    raise(NonGithubHomepage,
          'Gemspec does not have GitHub hompage URL.')
  end

  specification.homepage.split('github.com/').last
end
version_milestone() click to toggle source
# File lib/pr_log/gemspec.rb, line 15
def version_milestone
  milestone_format % version_components
end

Private Instance Methods

version_components() click to toggle source
# File lib/pr_log/gemspec.rb, line 21
def version_components
  components = specification.version.to_s.split('.')

  [:major, :minor, :patch]
    .each_with_index
    .each_with_object({}) do |(name, index), result|
    result[name] = components[index]
  end
end