From 2f7e2d79a8e8f48c7494651b7a7e5ba1c7849c80 Mon Sep 17 00:00:00 2001
From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Date: Wed, 16 Aug 2023 14:08:20 -0400
Subject: [PATCH] Refactored the name of frames

---
 lib/apex/encoder/aprs_kiss.rb                          |  2 +-
 lib/apex/encoder/igate_tcp.rb                          |  2 +-
 lib/apex/frame.rb                                      |  6 +++---
 lib/apex/frame/{frame.rb => immutable_frame.rb}        | 10 +++++-----
 .../frame/{unpathed_frame.rb => immutable_message.rb}  |  4 ++--
 ...ostic_frame.rb => path_agnostic_immutable_frame.rb} |  2 +-
 spec/apex/encoder/aprs_kiss_spec.rb                    |  2 +-
 spec/apex/encoder/igate_tcp_spec.rb                    |  2 +-
 8 files changed, 15 insertions(+), 15 deletions(-)
 rename lib/apex/frame/{frame.rb => immutable_frame.rb} (71%)
 rename lib/apex/frame/{unpathed_frame.rb => immutable_message.rb} (92%)
 rename lib/apex/frame/{path_agnostic_frame.rb => path_agnostic_immutable_frame.rb} (89%)

diff --git a/lib/apex/encoder/aprs_kiss.rb b/lib/apex/encoder/aprs_kiss.rb
index ce9a63b..c5f54bc 100644
--- a/lib/apex/encoder/aprs_kiss.rb
+++ b/lib/apex/encoder/aprs_kiss.rb
@@ -39,7 +39,7 @@ module Apex
 
           path = Apex::Path.from_raw(frame_map[:path])
 
-          return Apex::Frame.new(source, destination, path, frame_map[:payload])
+          return Apex::ImmutableFrame.new(source, destination, path, frame_map[:payload])
         end
 
         public
diff --git a/lib/apex/encoder/igate_tcp.rb b/lib/apex/encoder/igate_tcp.rb
index ea710d7..d9a2489 100644
--- a/lib/apex/encoder/igate_tcp.rb
+++ b/lib/apex/encoder/igate_tcp.rb
@@ -60,7 +60,7 @@ module Apex
             decoded_path = Apex::Path.from_raw(path)
             decoded_payload = frame_so_far
 
-            return Apex::Frame.new(decoded_source, decoded_destination, decoded_path, decoded_payload)
+            return Apex::ImmutableFrame.new(decoded_source, decoded_destination, decoded_path, decoded_payload)
         end
 
         private
diff --git a/lib/apex/frame.rb b/lib/apex/frame.rb
index 240247a..384b639 100644
--- a/lib/apex/frame.rb
+++ b/lib/apex/frame.rb
@@ -1,6 +1,6 @@
-require 'apex/frame/frame'
+require 'apex/frame/immutable_frame'
 require 'apex/frame/entity'
 require 'apex/frame/hop'
 require 'apex/frame/path'
-require 'apex/frame/unpathed_frame'
-require 'apex/frame/path_agnostic_frame'
+require 'apex/frame/immutable_message'
+require 'apex/frame/path_agnostic_immutable_frame'
diff --git a/lib/apex/frame/frame.rb b/lib/apex/frame/immutable_frame.rb
similarity index 71%
rename from lib/apex/frame/frame.rb
rename to lib/apex/frame/immutable_frame.rb
index c77eeca..93ca72d 100644
--- a/lib/apex/frame/frame.rb
+++ b/lib/apex/frame/immutable_frame.rb
@@ -1,8 +1,8 @@
-require 'apex/frame/unpathed_frame'
+require 'apex/frame/immutable_message'
 
 module Apex
   public
-  class Frame < Apex::UnpathedFrame
+  class ImmutableFrame < Apex::ImmutableMessage
     attr_accessor :path
 
     protected
@@ -17,8 +17,8 @@ module Apex
 
     public
     def eql?(other)
-      raise ArgumentError.new("The argument can not be a UnpathedFrame or a PathAgnosticFrame") if ((other.instance_of? UnpathedFrame) || (other.instance_of? PathAgnosticFrame))
-      raise ArgumentError.new("The argument must be of type Frame (or a child class).") if not other.kind_of? Frame
+      raise ArgumentError.new("The argument can not be a UnpathedFrame or a PathAgnosticFrame") if ((other.instance_of? ImmutableMessage) || (other.instance_of? PathAgnosticImmutableFrame))
+      raise ArgumentError.new("The argument must be of type Frame (or a child class).") if not other.kind_of? ImmutableFrame
 
       return self == other
     end
@@ -43,7 +43,7 @@ module Apex
 
     public
     def path_agnostic_identity
-      return PathAgnosticFrame.new(self.source, self.destination, self.path, self.payload)
+      return PathAgnosticImmutableFrame.new(self.source, self.destination, self.path, self.payload)
     end
   end
 end
diff --git a/lib/apex/frame/unpathed_frame.rb b/lib/apex/frame/immutable_message.rb
similarity index 92%
rename from lib/apex/frame/unpathed_frame.rb
rename to lib/apex/frame/immutable_message.rb
index 334641a..7bd8b29 100644
--- a/lib/apex/frame/unpathed_frame.rb
+++ b/lib/apex/frame/immutable_message.rb
@@ -8,7 +8,7 @@ module Apex
   #   diff_frame = Apex.new('WI2ARD-1', 'OMG', ['WIDE2-2' 'WIDE1-1'], 'different payload')
   #   assert not orig_frame.eql? diff_frame
   public
-  class UnpathedFrame
+  class ImmutableMessage
     attr_accessor :source, :destination, :payload
 
     ##
@@ -41,7 +41,7 @@ module Apex
 
     public
     def path_agnostic_eql?(other)
-      raise ArgumentError.new("The argument must be either an UnpathedFrame or a PathAgnosticFrame") if not ((other.instance_of? Apex::UnpathedFrame) || (other.instance_of? Apex::PathAgnosticFrame))
+      raise ArgumentError.new("The argument must be either an ImmutableMessage or a PathAgnosticFrame") if not ((other.instance_of? Apex::ImmutableMessage) || (other.instance_of? Apex::PathAgnosticImmutableFrame))
 
       return self.path_agnostic_equality? other
     end
diff --git a/lib/apex/frame/path_agnostic_frame.rb b/lib/apex/frame/path_agnostic_immutable_frame.rb
similarity index 89%
rename from lib/apex/frame/path_agnostic_frame.rb
rename to lib/apex/frame/path_agnostic_immutable_frame.rb
index d960231..4863f73 100644
--- a/lib/apex/frame/path_agnostic_frame.rb
+++ b/lib/apex/frame/path_agnostic_immutable_frame.rb
@@ -1,6 +1,6 @@
 module Apex
   private
-  class PathAgnosticFrame < Frame
+  class PathAgnosticImmutableFrame < ImmutableFrame
     protected
     def initialize(source, destination, path, payload)
       super(source, destination, path, payload)
diff --git a/spec/apex/encoder/aprs_kiss_spec.rb b/spec/apex/encoder/aprs_kiss_spec.rb
index 54d9c5e..1257227 100644
--- a/spec/apex/encoder/aprs_kiss_spec.rb
+++ b/spec/apex/encoder/aprs_kiss_spec.rb
@@ -1,6 +1,6 @@
 require_relative '../../../lib/apex'
 
-FRAME_KISS = Apex::Frame.new(
+FRAME_KISS = Apex::ImmutableFrame.new(
     Apex::Entity.from_raw('W2GMD-1'),
     Apex::Entity.from_raw('OMG'),
     Apex::Path.from_raw(['WIDE1-1', 'WIDE2-2']),
diff --git a/spec/apex/encoder/igate_tcp_spec.rb b/spec/apex/encoder/igate_tcp_spec.rb
index f1b6607..8dbcd2c 100644
--- a/spec/apex/encoder/igate_tcp_spec.rb
+++ b/spec/apex/encoder/igate_tcp_spec.rb
@@ -1,6 +1,6 @@
 require_relative '../../../lib/apex'
 
-DECODED_FRAME_IGATE = Apex::Frame.new(
+DECODED_FRAME_IGATE = Apex::ImmutableFrame.new(
     Apex::Entity.from_raw('W2GMD-1'),
     Apex::Entity.from_raw('OMG'),
     Apex::Path.from_raw(['WIDE1-1', 'WIDE2-2']),
-- 
GitLab