Class: Jira::Command::Votes

Inherits:
Base
  • Object
show all
Defined in:
lib/jira/commands/vote.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ticket) ⇒ Votes

Returns a new instance of Votes.



57
58
59
# File 'lib/jira/commands/vote.rb', line 57

def initialize(ticket)
  self.ticket = ticket
end

Instance Attribute Details

#ticketObject

Returns the value of attribute ticket.



55
56
57
# File 'lib/jira/commands/vote.rb', line 55

def ticket
  @ticket
end

Instance Method Details

#runObject



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/jira/commands/vote.rb', line 61

def run
  return if ticket.empty?
  return if .empty?

  voters = ['voters']
  if !voters.nil? and voters.count > 0
    voters.each do |voter|
      displayName = voter['displayName']

      printf "[%2d]", voters.index(voter)
      puts "  #{Jira::Format.user(displayName)}"
    end
  else
    puts "There are no votes on ticket #{ticket}."
  end
end