Sha256: bfbbf6c552a8a70af1623bc0841caafd67501440b93e4fc3ea81450bafce597a

Contents?: true

Size: 609 Bytes

Versions: 2

Compression:

Stored size: 609 Bytes

Contents

# frozen_string_literal: true

#
# Copyright (c) 2019-present, Blue Marble Payroll, LLC
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#

class Person
  attr_accessor :dob, :first, :id, :last, :smoker

  def initialize(attrs = {})
    attrs.each do |k, v|
      send("#{k}=", v) if respond_to?(k)
    end
  end

  def eql?(other)
    to_hash == other.to_hash
  end

  def ==(other)
    eql?(other)
  end

  def to_hash
    {
      id: id,
      first: first,
      last: last,
      smoker: smoker,
      dob: dob
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hashematics-1.1.0 spec/examples/person.rb
hashematics-1.0.0 spec/examples/person.rb