# Gemfile
group :development, :test do
gem 'minitest-rails'
gem 'fabrication'
end
| # Returns true if sentence is a palindrome. | |
| # racecar ---> true | |
| # hello ---> false | |
| # aba aba ---> true | |
| # Never odd or even ---> true | |
| def palindrome?(sentence) | |
| # downcase the sentence | |
| downcased_sentence = sentence.downcase | |
| # remove all the spaces in the sentence |
| require_relative "hangman" | |
| # figure out a random word to use for the game | |
| class HangPlay | |
| # Starts the hangman game | |
| def self.start | |
| @@game = Hangman.new("lemonade") | |
| self.show_round | |
| end |
| class Hangman | |
| # This class will be used to run an instance of a hangman game | |
| # It is only concerned with one run through of the game | |
| # It is not responsible for human interaction | |
| attr_accessor :word | |
| attr_accessor :chances | |
| attr_accessor :board |
| require_relative "hangman" | |
| # figure out a random word to use for the game | |
| class HangPlay | |
| # Starts the hangman game | |
| def self.start | |
| @@game = Hangman.new("lemonade") | |
| while true |
| require_relative "hang_play" | |
| HangPlay.start | |
| class Dog | |
| # class variable | |
| @@default_description = "A dog is a furry mammal." | |
| attr_accessor :name | |
| attr_accessor :age | |
| attr_accessor :description | |
| def initialize(name, description) |
| TestApp::Application.configure do | |
| # Settings specified here will take precedence over those in config/application.rb | |
| # The production environment is meant for finished, "live" apps. | |
| # Code is not reloaded between requests | |
| config.cache_classes = true | |
| config.assets.digest = true | |
| config.assets.compile = false | |
| config.assets.compress = true |
# Gemfile
group :development, :test do
gem 'minitest-rails'
gem 'fabrication'
end
Tested on Yosemite. Should work on El Cap. Message me if it doesn't.