Skip to content

Instantly share code, notes, and snippets.

@dummied
Created August 18, 2017 17:15
Show Gist options
  • Save dummied/a305888cc15872fbcc70765e99065e50 to your computer and use it in GitHub Desktop.
Save dummied/a305888cc15872fbcc70765e99065e50 to your computer and use it in GitHub Desktop.
💩 = Class.new do
def self.alltime_poops
@poops ||= []
end
def self.stats
puts "You've pooped #{alltime_poops.count{ |poo| poo.timestamp.strftime("%A, %b %d") == Time.now.strftime("%A, %b %d") }} times today."
end
attr_accessor :volume, :consistency, :timestamp, :color
def initialize(volume:, consistency:, timestamp: Time.now, color: "Brown")
@volume = volume
@consistency = consistency
@timestamp = timestamp
@color = color
end
def evacuate
self.class.alltime_poops << self
puts "Ah. That feels better."
end
end
rand(200).times do
💩.new(volume: "medium", consistency: "loose").evacuate
end
💩.stats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment