Sha256: 25f52b4c291f25907bbc377d7ba13edf6767c426abd044f07d096d787bbb2609

Contents?: true

Size: 501 Bytes

Versions: 5

Compression:

Stored size: 501 Bytes

Contents

module Story

  # Returns the URL for the story at Pivotal Tracker.
  def story_url(story_id)
    "https://www.pivotaltracker.com/story/show/#{story_id}"
  end

  # Returns the ids of delivered stories found in the given text.
  def delivered_ids(text)
    delivered  = text.scan(/\[Deliver(?:s|ed) (.*?)\]/).flatten
    # Handle multiple ids, i.e., '[Delivers #<id 1> #<id 2>]'
    delivered.inject([]) do |ids, element|
      ids.concat(element.scan(/[0-9]{8,}/).flatten)
      ids
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pivotal-github-1.0.11 lib/pivotal-github/story.rb
pivotal-github-1.0.10 lib/pivotal-github/story.rb
pivotal-github-1.0.9 lib/pivotal-github/story.rb
pivotal-github-1.0.8 lib/pivotal-github/story.rb
pivotal-github-1.0.7 lib/pivotal-github/story.rb