This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| teams =[] | |
| def no_dups?(teams) | |
| names=[] | |
| teams.each do |team| | |
| if names.include?(team['team_name']) | |
| return false | |
| else | |
| names << team['team_name'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| teams =[] | |
| def no_dups?(teams) | |
| names=[] | |
| teams.each do |team| | |
| if names.include?(team['team_name']) | |
| return false | |
| else | |
| names << team['team_name'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'csv' | |
| failures=[] | |
| lows=[] | |
| mids=[] | |
| highs=[] | |
| CSV.foreach('test.csv', headers: true) do |row| | |
| score = row[1].to_f | |
| if score < 70 | |
| fails = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Car | |
| class << self | |
| @@make_table = {} | |
| def add_make(make_model) | |
| make_model.each do |key, value| | |
| @@make_table[key] = value | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Animal | |
| attr_reader :name | |
| def initialize(name) | |
| @name = name | |
| end | |
| def emote | |
| [ | |
| 'make various noises' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Whiteboard | |
| attr_accessor :contents | |
| def initialize(contents = []) | |
| @contents = contents | |
| end | |
| def erase | |
| @contents = [] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| personal_information = [] | |
| salutations = [ | |
| 'Mr.', | |
| 'Mrs.', | |
| 'Mr.', | |
| 'Dr.', | |
| 'Ms.' | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Television | |
| def initialize(manufacturor, size, resolution = nil, flatscreen? = false) | |
| @manufacturor = manufacturor | |
| @size = size | |
| if resolution.nil? | |
| @resolution = 'not sure' | |
| else | |
| @resolution = resolution | |
| end | |
| if flatscreen? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Card | |
| def initialize(rank = nil, suit = nil) | |
| if suit.nil? | |
| @suit = ['♠', '♣', '♥', '♦'].sample | |
| else | |
| @suit = suit | |
| end | |
| if rank.nil? | |
| @rank = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'J', 'Q', 'K', 'A'].sample | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| # encoding: UTF-8 | |
| class Blackjack | |
| SUITS = ['♠', '♣', '♥', '♦'] | |
| VALUES = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A'] | |
| def initialize | |
| @deck = [] | |
| @player=[] |