Sha256: a75ccdc52440e01680b52178684f7f068d533c246ab02327429eacc886421de0

Contents?: true

Size: 506 Bytes

Versions: 10

Compression:

Stored size: 506 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.uniq
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pivotal-github-1.2.0 lib/pivotal-github/story.rb
pivotal-github-1.1.7 lib/pivotal-github/story.rb
pivotal-github-1.1.6 lib/pivotal-github/story.rb
pivotal-github-1.1.5 lib/pivotal-github/story.rb
pivotal-github-1.1.4 lib/pivotal-github/story.rb
pivotal-github-1.1.3 lib/pivotal-github/story.rb
pivotal-github-1.1.2 lib/pivotal-github/story.rb
pivotal-github-1.1.1 lib/pivotal-github/story.rb
pivotal-github-1.1.0 lib/pivotal-github/story.rb
pivotal-github-1.0.12 lib/pivotal-github/story.rb