Sha256: 11f9c08edcb2164d4f33770f0d6daeb0ef294b0644565d6e5ae88f540d33031e

Contents?: true

Size: 404 Bytes

Versions: 1

Compression:

Stored size: 404 Bytes

Contents

# frozen_string_literal: true

class Person
  class RecordNotFound < StandardError; end

  include GlobalID::Identification

  attr_reader :id

  def self.find(id)
    raise RecordNotFound.new("Cannot find person with ID=404") if id.to_i == 404
    new(id)
  end

  def initialize(id)
    @id = id
  end

  def ==(other_person)
    other_person.is_a?(Person) && id.to_s == other_person.id.to_s
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-on-quails-0.1.0 activejob/test/models/person.rb