Class: Ankit::ScoreCommand

Inherits:
EventTraversingCommand show all
Includes:
CardNaming, EventFormatting
Defined in:
lib/ankit/score_command.rb

Constant Summary

Constants inherited from Command

Command::COMMANDS

Instance Attribute Summary

Attributes inherited from Command

#args, #options, #runtime

Instance Method Summary collapse

Methods included from CardNaming

#card_wildcard_for, #to_card_name, #to_card_path

Methods included from EventFormatting

#format_as_score

Methods inherited from EventTraversingCommand

#each_event

Methods inherited from Command

available, by_name, command_name, define_options, #initialize, option_spec

Constructor Details

This class inherits a constructor from Ankit::Command

Instance Method Details

#executeObject



15
16
17
18
19
20
21
22
# File 'lib/ankit/score_command.rb', line 15

def execute()
  args.each do |a|
    list = to_enum(:each_event, to_card_name(a)).to_a
    (options[:last] ? list.sort_by(&:round).reverse.take(1) : list).each do |e|
      runtime.stdout.print("#{format_as_score(e)}\n")
    end
  end
end