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 'json' | |
class BookMetaMerge | |
def initialize(output_file='result_example.file') | |
@output_file = output_file | |
end | |
def merge_files(file1, file2) | |
hash_one = JSON.parse(file1) | |
hash_two = JSON.parse(file2) |
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 Die | |
def initialize(number_of_sides) | |
@number_of_sides = number_of_sides | |
end | |
def sides | |
@number_of_sides | |
end | |
def roll |
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 'date' | |
class Task | |
def initialize(description) | |
@description = description | |
@status = "incomplete" | |
@priority = 5 | |
@due_date = Date.today.to_s | |
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 './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" |
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 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 |
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 Address | |
def initialize | |
@street | |
@city | |
@state | |
@type | |
end | |
def complete_address | |
"#{@street} #{@city}, #{@state}" |
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 Board | |
def initialize(grid_length) | |
@spaces = [] | |
@grid_length = grid_length | |
create_spaces | |
end | |
attr_reader :spaces, :grid_length | |
def create_spaces |
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 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 |
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 List | |
attr_reader :name, :id | |
def initialize(name) | |
@name = name | |
end | |
def ==(another_list) | |
self.name == another_list.name |
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 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 |
OlderNewer