Skip to content

Instantly share code, notes, and snippets.

View steven-ferguson's full-sized avatar

steven-ferguson

  • Dave
  • Los Angeles, CA
View GitHub Profile
class Die
def initialize(number_of_sides)
@number_of_sides = number_of_sides
end
def sides
@number_of_sides
end
def roll
require 'date'
class Task
def initialize(description)
@description = description
@status = "incomplete"
@priority = 5
@due_date = Date.today.to_s
end
class Parcel
def initialize(weight, height, width, length)
@weight = weight
@height = height
@width = width
@length = length
@dimensional_weight = (@length * @width * @height)/ 166
end
def dimensional_weight
require './lib/triangles'
def main
@sides = []
puts "Please enter a side length"
@sides << gets.chomp
puts "Please enter another side length"
@sides << gets.chomp
puts "Please enter a third side length"
class Address
def initialize
@street
@city
@state
@type
end
def complete_address
"#{@street} #{@city}, #{@state}"
class Board
def initialize(grid_length)
@spaces = []
@grid_length = grid_length
create_spaces
end
attr_reader :spaces, :grid_length
def create_spaces
class Board
attr_reader :columns, :height, :width
def initialize(width, height)
@columns = []
@height = height
@width = width
width.times do |position|
column = Column.new(position, height)
columns << column
class List
attr_reader :name, :id
def initialize(name)
@name = name
end
def ==(another_list)
self.name == another_list.name
class Address
attr_reader :contact_id, :street, :city, :state, :zip, :type, :full
def initialize(contact_id, street, city, state, zip, type="")
@contact_id = contact_id
@street = street
@city = city
@state = state
@zip = zip
@type = type
@steven-ferguson
steven-ferguson / book.rb
Created September 12, 2013 00:55
Library App
class Book
attr_reader :title, :isbn, :author_last_name, :author_first_name, :id, :copies, :number_of_copies
def initialize(title, isbn, author_last_name, author_first_name, number_of_copies)
@title = title
@isbn = isbn
@author_first_name = author_first_name
@author_last_name = author_last_name
@number_of_copies = number_of_copies