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
# Dependencies | |
require "csv" | |
require 'sunlight' | |
# Class Definition | |
class EventManager | |
INVALID_ZIPCODE = "00000" | |
INVALID_PHONE_NUMBER = "0000000000" | |
Sunlight::Base.api_key = "e179a6973728c4dd3fb1204283aaccb5" | |
def initialize(filename) |
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
def game(match) | |
if match[0][1].upcase =="R" | |
if match[1][1].upcase == "P" | |
match[1] | |
elsif match[1][1].upcase == "S" | |
match[0] | |
else | |
"It's a Tie!" | |
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 Array | |
def new_inject | |
result = 0 | |
(1..self.length).each do |i| | |
result = yield(result, self[i-1]) | |
end | |
result |
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 Array | |
def new_collect | |
self.collect do |n| | |
yield n | |
end | |
end | |
end | |
RSPEC: |
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 RPNCalculator | |
attr_accessor :calculator, :result, :subtotal, :mini_array | |
def initialize | |
@calculator = [] | |
@mini_array = [] | |
@result = 0 | |
@subtotal = 0 | |
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 RPNCalculator | |
attr_accessor :calculator, :result, :subtotal, :mini_array | |
def initialize | |
@calculator = [] | |
@mini_array = [] | |
@result = 0 | |
@subtotal = 0 | |
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 RPNCalculator | |
attr_accessor :calculator, :result | |
def initialize | |
@calculator = [] | |
@result = 0 | |
end | |
def push(arg) |
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 RPN | |
attr_accessor :calculator | |
def initialize | |
@calculator = [] | |
end | |
def push(arg) |
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 Dictionary | |
attr_accessor :this_dictionary | |
def initialize | |
this_dictionary = {} | |
@this_dictionary = this_dictionary | |
end | |
def entries |
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
def Calculator | |
def add(num1,num2) | |
@num1= num1 | |
@num2 = num2 | |
output("sum", num1 + num2) | |
end | |
def subtract(num1,num2) | |
@num1= num1 |