From d7f66ffb47fbdf3a27b1f8ae527da72211023e76 Mon Sep 17 00:00:00 2001 From: sanyakosivchuk Date: Sun, 26 Mar 2023 14:38:02 +0000 Subject: [PATCH] feature/RS-11-Create-class-for-audios --- lib/attachments/audio.rb | 7 +++++++ lib/attacments.rb | 12 ++++-------- lib/chat.rb | 2 +- lib/member.rb | 2 +- lib/message.rb | 8 ++++---- lib/start.rb | 2 +- 6 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 lib/attachments/audio.rb diff --git a/lib/attachments/audio.rb b/lib/attachments/audio.rb new file mode 100644 index 0000000..8cafd47 --- /dev/null +++ b/lib/attachments/audio.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class Message + # Class + class Audio < Attachments + end + end \ No newline at end of file diff --git a/lib/attacments.rb b/lib/attacments.rb index f548158..df41cf0 100644 --- a/lib/attacments.rb +++ b/lib/attacments.rb @@ -4,22 +4,18 @@ class Message # Class class Attachments - attr_accessor :message, :attaches + attr_accessor :message - def attachments - @attachments = [] - end - - def init(message) + def initialize(message) @message = message end def attach - message.attachments.push(self) + message.attachment = self end def choose raise NotImplementedError, 'Not implemented yet' end end -end +end \ No newline at end of file diff --git a/lib/chat.rb b/lib/chat.rb index dd3d49b..ab2a219 100644 --- a/lib/chat.rb +++ b/lib/chat.rb @@ -28,4 +28,4 @@ def status_change(member) 'active' end end -end +end \ No newline at end of file diff --git a/lib/member.rb b/lib/member.rb index 0d4d787..a7dc7ea 100644 --- a/lib/member.rb +++ b/lib/member.rb @@ -9,4 +9,4 @@ def initialize(name, messages = [], status = 'offline') @messages = messages @status = status end -end +end \ No newline at end of file diff --git a/lib/message.rb b/lib/message.rb index 83f3459..9ab2522 100644 --- a/lib/message.rb +++ b/lib/message.rb @@ -2,13 +2,13 @@ # Description/Explanation of Chat class class Message - attr_reader :text, :member, :chat, :attachments + attr_reader :text, :member, :chat, :attachment - def initialize(text, member, chat, attachments) + def initialize(text, member, chat, attachment) @text = text @member = member @chat = chat - @attachments = attachments[] + @attachment = attachment end def sticker; end @@ -26,4 +26,4 @@ def file; end def time; end def delete; end -end +end \ No newline at end of file diff --git a/lib/start.rb b/lib/start.rb index b335d01..1b52214 100644 --- a/lib/start.rb +++ b/lib/start.rb @@ -20,4 +20,4 @@ def require_all(relative_path) Dir["#{absolute_path}/**/*.rb"].sort.each do |file| require_relative file end -end +end \ No newline at end of file