Class: Ax25::ImmutableFrame

Inherits:
ImmutableMessage show all
Includes:
Frame
Defined in:
lib/ax25/frame/immutable_frame.rb

Direct Known Subclasses

PathAgnosticImmutableFrame

Instance Attribute Summary

Attributes included from Frame

#path

Attributes included from Message

#destination, #payload, #source

Instance Method Summary collapse

Methods inherited from ImmutableMessage

#path_agnostic_eql?, #path_agnostic_equality?, #path_agnostic_hash

Instance Method Details

#==(other) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ax25/frame/immutable_frame.rb', line 28

def ==(other)
  return false if not super(other)

  return false if not other.respond_to? :path

  if self.path.eql? other.path
     return true
  else
    return false
  end
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (ArgumentError)


20
21
22
23
24
25
# File 'lib/ax25/frame/immutable_frame.rb', line 20

def eql?(other)
  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? Frame

  return self == other
end

#hashObject



41
42
43
# File 'lib/ax25/frame/immutable_frame.rb', line 41

def hash
  return [super, self.path].hash
end

#path_agnostic_identityObject



46
47
48
# File 'lib/ax25/frame/immutable_frame.rb', line 46

def path_agnostic_identity
  return PathAgnosticImmutableFrame.new(self.source, self.destination, self.path, self.payload)
end