Sha256: b8533aa16bf77e39fa428152322d486ea47f9296a7322a9ef35eef6c4497ee3c

Contents?: true

Size: 387 Bytes

Versions: 3

Compression:

Stored size: 387 Bytes

Contents

module TTT
  class IOTerminal
    def present(prompt)
      print prompt
    end

    def present_with_new_line(prompt)
      puts prompt
    end

    def receive
      result = gets.chomp
      if is_int?(result)
        return result.to_i
      else
        return result.chomp
      end
    end

    private
    def is_int?(figure)
      Integer(figure) rescue false
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tic_tac_toe_bfox-0.3.0 lib/tictactoe/io_terminal.rb
tic_tac_toe_bfox-0.2.0 lib/tictactoe/io_terminal.rb
tic_tac_toe_bfox-0.1.0 lib/tictactoe/io_terminal.rb