nofxx/hooray

View on GitHub
lib/hooray/port.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Hooray
  #
  # Socket Port
  #
  class Port < Struct.new(:number, :protocol, :name)
    def name
      @name || Settings.services[number][protocol]
    end

    def <=>(other)
      number <=> other.number
    end

    def to_s
      "#{number}/#{protocol}"
    end
  end
end