Class: Posto::HumanComparison

Inherits:
Object
  • Object
show all
Defined in:
lib/posto/human_comparison.rb

Class Method Summary collapse

Class Method Details

.ask_human(x, y) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/posto/human_comparison.rb', line 11

def self.ask_human(x, y)
  while true do
    response = ask(template(Todo.hide_markdown(x), Todo.hide_markdown(y))).to_i
    return 0 if response == 0
    return -1 if response == 1
    return 1 if response == 2
  end
end

.template(x, y) ⇒ Object



6
7
8
9
# File 'lib/posto/human_comparison.rb', line 6

def self.template(x, y)
  "\n================\n\n1. #{x}\n\n2. #{y}\n\n" +
      "which one is more important? (1, 2 or just hit enter if you don't care): "
end