Class: Geera::Commands::List

Inherits:
Command
  • Object
show all
Defined in:
lib/geera/commands/list.rb

Instance Attribute Summary

Attributes inherited from Command

#argv, #config, #geera

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

#initialize, #ticket

Constructor Details

This class inherits a constructor from Geera::Commands::Command

Class Method Details

.handle?(command) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/geera/commands/list.rb', line 4

def self.handle? command
  'list' == command
end

Instance Method Details

#execute!Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/geera/commands/list.rb', line 17

def execute!
  tickets = geera.list number
  if tickets.empty?
    puts "No Tickets found"
  else
    tickets.first(10).each do |ticket|
      puts "#{ticket.key.ljust(8)} #{ticket.summary}"
    end
  end
end

#numberObject



8
9
10
11
12
13
14
15
# File 'lib/geera/commands/list.rb', line 8

def number
  ## Ensure that +number+ is actually a number
  begin
    @number = Integer(super)
  rescue ArgumentError
    @number = geera.filters.find { |f| f.name == super }.id
  end
end