Kaceka2016/ruby_part/intelligence_test.rb

15 lines
446 B
Ruby
Raw Normal View History

#require_relative 'crane_class'
require 'json'
2016-12-08 08:49:58 +01:00
def introduce
puts "Hello, sir. I'm Roman the Crane."
end
file = File.read('test.json')
words = JSON.parse(file)
file2 = File.read('past_forms.json')
past_formes = JSON.parse(file2)
puts (if words.values.any? { |e| words.key(e).eql? "movement" } && words.length > 1 then "I #{past_formes[words["movement"]] + ' ' + words["directions"]}" else "Ooops" end)
puts words["directions"]