Class: Yapt::Runner
- Inherits:
-
Boson::Runner
- Object
- Boson::Runner
- Yapt::Runner
- Defined in:
- lib/yapt.rb
Instance Attribute Summary collapse
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
Instance Method Summary collapse
- #images(id) ⇒ Object
-
#initialize ⇒ Runner
constructor
A new instance of Runner.
- #list(*args) ⇒ Object
- #move(id, destination) ⇒ Object
- #open(id = nil) ⇒ Object
- #show(id) ⇒ Object
Constructor Details
#initialize ⇒ Runner
Returns a new instance of Runner.
41 42 43 44 |
# File 'lib/yapt.rb', line 41 def initialize @start_time = Time.now super end |
Instance Attribute Details
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
40 41 42 |
# File 'lib/yapt.rb', line 40 def start_time @start_time end |
Instance Method Details
#images(id) ⇒ Object
62 63 64 |
# File 'lib/yapt.rb', line 62 def images(id) system_open Story.images_url(id) end |
#list(*args) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/yapt.rb', line 46 def list(*args) display_config = View.extract_display_config(args) @stories = Story.find(args) display_config ||= (@stories.length > 1) ? "simple" : "detail" output View.new(@stories).display(display_config) end |
#move(id, destination) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/yapt.rb', line 66 def move(id, destination) mover = Move.setup(id, destination) puts puts mover.description puts View.new([mover.to_move, mover.target]).display("simple") = ask("Make this move? ").downcase if %w(y yes).include?() mover.execute! puts "Moved!" else puts "Aborted. Oh well." end end |
#open(id = nil) ⇒ Object
58 59 60 |
# File 'lib/yapt.rb', line 58 def open(id = nil) system_open Story.just_url(id) end |
#show(id) ⇒ Object
53 54 55 56 |
# File 'lib/yapt.rb', line 53 def show(id) @story = Story.find(id) output View.new([@story]).display("detail") end |