class EvaluateInput

Attributes

eval_input[RW]
input[RW]

Public Class Methods

new(input) click to toggle source
# File lib/evaluate_input.rb, line 7
def initialize(input)
  @input = input.downcase
  @eval_input = []
  @valid = false
end

Public Instance Methods

exit?() click to toggle source
# File lib/evaluate_input.rb, line 21
def exit?
  input == "q" || input == "quit"
  #puts "press q to exit game"

end
finished?() click to toggle source

def convert_to_array

  eval_input = input.split(//)
end
# File lib/evaluate_input.rb, line 17
def finished?
  input == 'q' || input =='quit'
end
input_is_valid?() click to toggle source
# File lib/evaluate_input.rb, line 28
def input_is_valid?
  eval_input = input.split(//)
  eval_input.all? {|char| char == "r" || char == "b" || char == "y" || char == "g" }
end
instructions?() click to toggle source
# File lib/evaluate_input.rb, line 47
def instructions?
  input == "i" || input == "instructions"
end
length_long?() click to toggle source
# File lib/evaluate_input.rb, line 38
def length_long?
  #eval_input = input.split(//)
  input_is_valid? && input.split(//).length > 4
end
length_short?() click to toggle source
# File lib/evaluate_input.rb, line 33
def length_short?
  #eval_input = input.split(//)
  input_is_valid? && input.split(//).length < 4
end
play?() click to toggle source
# File lib/evaluate_input.rb, line 43
def play?
  input == "p" || input == "play"
end