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_name.rb
2017-07-28 01:47:18 +00:00

24 lines
574 B
Ruby

# frozen_string_literal: true
module Actions
class ChangeFriendName < Obredux::Action
attr_reader :friend, :new_name
def initialize(friend, new_name)
self.friend = friend
self.new_name = new_name
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_name=(value)
raise TypeError, "expected name to be a #{String}" unless value.is_a? String
@new_name = value.frozen? ? value : value.dup.freeze
end
end
end