Class: Maestro::Command::Find

Inherits:
Maestro::Command show all
Defined in:
lib/commands/story_commands.rb

Instance Method Summary collapse

Methods inherited from Maestro::Command

command, describe

Constructor Details

#initialize(query) ⇒ Find

Returns a new instance of Find.



14
15
16
# File 'lib/commands/story_commands.rb', line 14

def initialize(query)
  @query = query
end

Instance Method Details

#invokeObject



18
19
20
21
22
23
# File 'lib/commands/story_commands.rb', line 18

def invoke
  stories = Maestro::Story.find(:all, :params => { :context => 'user', :project_id => Maestro::Config[:project_id] })
  stories.select{ |s| s.title =~ Regexp.new(@query) }.collect do |story|
    story.to_s
  end.join("\n")
end