Skip to content

Instantly share code, notes, and snippets.

@dhenze
Last active January 22, 2019 13:45
Show Gist options
  • Save dhenze/b97be08e1972bfb06cb46a66c72ac1aa to your computer and use it in GitHub Desktop.
Save dhenze/b97be08e1972bfb06cb46a66c72ac1aa to your computer and use it in GitHub Desktop.
require "securerandom"
class OrderId
attr_reader :id
def initialize(id)
fail TypeError.new("String required") unless id.is_a?(String)
@id = id
end
def self.generate_new
new(SecureRandom.uuid)
end
def equals(other)
self.id == (other.id)
end
def to_s
"#{id}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment