Class: Maestro::Command::Time

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

Instance Method Summary collapse

Methods inherited from Maestro::Command

command, describe

Constructor Details

#initialize(number, time) ⇒ Time

Returns a new instance of Time.



39
40
41
42
# File 'lib/commands/story_commands.rb', line 39

def initialize(number, time)
  @number = number
  @time   = time
end

Instance Method Details

#invokeObject



44
45
46
47
48
# File 'lib/commands/story_commands.rb', line 44

def invoke
  hours, minutes = @time.split(":")
  story = update :time, (hours.to_i * 60 + (minutes.to_i || 0))
  story.to_s + " time: #{(story.time / 60).to_i}:#{(story.time % 60).to_i}"
end