Archived
1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
cli-old/lib/actions/change_friend_status.rb
2017-07-28 01:47:18 +00:00

24 lines
590 B
Ruby

# frozen_string_literal: true
module Actions
class ChangeFriendStatus < Obredux::Action
attr_reader :friend, :new_status
def initialize(friend, new_status)
self.friend = friend
self.new_status = new_status
end
private
def friend=(value)
raise TypeError, "expected friend to be a #{Tox::Friend}" unless value.is_a? Tox::Friend
@friend = value
end
def new_status=(value)
raise TypeError, "expected status to be a #{Symbol}" unless value.is_a? Symbol
@new_status = value.frozen? ? value : value.dup.freeze
end
end
end