diff --git a/lib/apex/encoder/aprs_kiss.rb b/lib/apex/encoder/aprs_kiss.rb index ce9a63b80634ea3f73f7af2f09c3ddfd37a5b448..c5f54bc8794a17579e492555bd60ec33918ff19b 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 ea710d7fc769dd1c4b73870bd65d333191053f5b..d9a24896601497dc5abf2cb47f62730db2359bc4 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 240247a71d13f1ce68edec0f2b052c310f02e473..384b639e4c36c98db00d1d69fc51aa6fe3116fa1 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 c77eeca1922f1adc90a14e3954ef19a7f79d3d32..93ca72dadecab6f03599c12440770d6f9f08f522 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 334641a2d365ccaeaf4bc5914e610bf2878ab422..7bd8b294f087f499de603c9a55a31914d919ba04 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 d9602313ec6c1c1c6623452f3e8e91bff1a8c95d..4863f730d620d86b68c8721ff4c5b8545a83ec6a 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 54d9c5e9bb3f268eb6f9a03ef8e2d052f00669a2..12572273f2e8225148b8db7f6685cdcbe27c38bd 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 f1b660771dc4e516b5e2e2aaf85089f58934c5d0..8dbcd2c2ae661d0d7dbe8014352069d93a2786e3 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']),