Sha256: f6be557d877accdf268c2cdf1b070b403f0e2b434d66bd56af777a45ae4792c7

Contents?: true

Size: 376 Bytes

Versions: 1

Compression:

Stored size: 376 Bytes

Contents

module Shared
  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)
        result.to_i
      else
        result.chomp
      end
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
games_bfox-0.6.0 lib/games/shared/io_terminal.rb