This file contains 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 'pry' | |
class Integer | |
Roman_hash = { | |
1 => "I", | |
5 => "V", | |
10 => "X", | |
50 => "L", | |
100 => "C", |
This file contains 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
#attr_name = "attributes" | |
class Person | |
def initialize(attr_name) | |
Person.class_eval {class << self; self end}.send(:attr_accessor,attr_name) | |
end | |
end |
This file contains 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 'sqlite3' | |
require 'pry' | |
class Dog | |
attr_accessor :name, :color, :id | |
@@db = SQLite3::Database.new 'dogs.db' | |
def self.find(id) | |
find = "SELECT * FROM dogs WHERE id = ?" |
This file contains 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 School | |
attr_accessor :name, :roster | |
def initialize(name) | |
@roster = {} | |
@name = name | |
end | |
def add_student(student_name, grade) |
This file contains 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 Triangle | |
attr_accessor :side_a, :side_b, :side_c | |
def initialize(side_a, side_b, side_c) | |
@side_a = side_a | |
@side_b = side_b | |
@side_c = side_c | |
puts 2 | |
end |
This file contains 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 School | |
attr_accessor :name, :roster | |
def initialize(name) | |
@roster = {} | |
@name = name | |
end | |
def add_student(student_name, grade) |
This file contains 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 'simplecov' | |
SimpleCov.start | |
require 'json' | |
require 'rspec' | |
require_relative 'jukebox' | |
require_relative 'song' | |
RSpec.configure do |config| | |
# Use color in STDOUT |
This file contains 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 Jukebox | |
attr_accessor :songs, :desire, :current_song #:song_hash | |
def initialize(songs) | |
@songs = songs | |
#@song_hash = {} | |
help | |
end |
This file contains 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 StudentScraper | |
attr_accessor :main_index_url | |
def initialize(main_index_url) | |
@main_index_url = main_index_url | |
end | |
def call | |
require 'nokogiri' | |
require 'open-uri' |
This file contains 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_relative './student_scraper' | |
require_relative './student' | |
require_relative './CLIstudent.rb' | |
require 'pry' | |
main_index_url = "http://students.flatironschool.com" | |
student_scrape = StudentScraper.new(main_index_url) | |
student_array = student_scrape.c2 | |
student_array.each do |student_hash| |
NewerOlder