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/add_friend_message.rb

24 lines
550 B
Ruby

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