Skip to content

Instantly share code, notes, and snippets.

View jordanhudgens's full-sized avatar

Jordan Hudgens jordanhudgens

View GitHub Profile
require 'pp'
my_var = "Hey There"
my_arr = [1, 2, 3, 4, 5, 6, 7]
my_json = "{
id: 1,
title: 'Test Blog Post',
description: 'Here is the content',
puts "What is your name?"
name = gets.chomp
if name == "dog"
p true
else
p false
end
require 'rubygems'
require 'decisiontree'
training = [
[98.7, 'healthy'],
[99.1, 'healthy'],
[99.5, 'sick'],
[100.5, 'sick'],
[102.5, 'crazy sick'],
[107.5, 'dead'],
class Invoice
def initialize(customer, total)
@customer = customer
@total = total
end
def summary
puts "Invoice:"
puts "Customer: #{@customer}"
puts "Total: #{@total}"
class OrderReport
def initialize(customer:, total:)
@customer = customer
@total = total
end
end
class Invoice < OrderReport
def print_out
puts "Invoice"
class Invoice
def initialize(customer:, total:)
@customer = customer
@total = total
end
def summary
puts "Invoice"
puts @customer
puts @total
class Car
attr_accessor :doors, :color
def initialize(doors:, color:)
@doors = Array(1..doors)
@color = color
end
def paint_doors
@doors.map { |door| puts "Door #{door} painted #{@color}" }
class Car
attr_accessor :doors, :color
def initialize(doors:, color:)
@doors = Array(1..doors)
@color = color
end
def paint_doors
@doors.map { |door| puts "Door #{door} painted #{@color}" }
require 'forwardable'
class Blog
def edit_post
puts "Post edited"
end
def delete_post
puts "Post removed"
end
# Violation
# require 'date'
# class User
# attr_accessor :settings, :email
# def initialize(email:)
# @email = email
# end
# end