Module: Story

Included in:
StoryAccept, StoryOpen, StoryPullRequest
Defined in:
lib/pivotal-github/story.rb

Instance Method Summary collapse

Instance Method Details

#delivered_ids(text) ⇒ Object

Returns the ids of delivered stories found in the given text.



9
10
11
12
13
14
15
16
# File 'lib/pivotal-github/story.rb', line 9

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

#story_url(story_id) ⇒ Object

Returns the URL for the story at Pivotal Tracker.



4
5
6
# File 'lib/pivotal-github/story.rb', line 4

def story_url(story_id)
  "https://www.pivotaltracker.com/story/show/#{story_id}"
end