Class: ImmosquareConstants::Ip::IpResult
- Inherits:
-
Object
- Object
- ImmosquareConstants::Ip::IpResult
- Defined in:
- lib/immosquare-constants/ip.rb
Overview
##
Simple class to provide dot notation access to IP addresses
##
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#local ⇒ Object
readonly
Returns the value of attribute local.
-
#public ⇒ Object
readonly
Returns the value of attribute public.
Instance Method Summary collapse
- #each ⇒ Object
- #each_with_index ⇒ Object
-
#initialize(local_ip, public_ip, client_ip) ⇒ IpResult
constructor
A new instance of IpResult.
- #inspect ⇒ Object
- #to_a ⇒ Object
- #to_h ⇒ Object
- #to_hash ⇒ Object
- #to_json ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(local_ip, public_ip, client_ip) ⇒ IpResult
Returns a new instance of IpResult.
16 17 18 19 20 |
# File 'lib/immosquare-constants/ip.rb', line 16 def initialize(local_ip, public_ip, client_ip) @local = local_ip @public = public_ip @client = client_ip end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
14 15 16 |
# File 'lib/immosquare-constants/ip.rb', line 14 def client @client end |
#local ⇒ Object (readonly)
Returns the value of attribute local.
14 15 16 |
# File 'lib/immosquare-constants/ip.rb', line 14 def local @local end |
#public ⇒ Object (readonly)
Returns the value of attribute public.
14 15 16 |
# File 'lib/immosquare-constants/ip.rb', line 14 def public @public end |
Instance Method Details
#each ⇒ Object
54 55 56 |
# File 'lib/immosquare-constants/ip.rb', line 54 def each(&) to_hash.each(&) end |
#each_with_index ⇒ Object
58 59 60 |
# File 'lib/immosquare-constants/ip.rb', line 58 def each_with_index(&) to_hash.each_with_index(&) end |
#inspect ⇒ Object
42 43 44 |
# File 'lib/immosquare-constants/ip.rb', line 42 def inspect "#<ImmosquareConstants::Ip::IpResult local: #{@local.inspect}, public: #{@public.inspect}, client: #{@client.inspect}>" end |
#to_a ⇒ Object
46 47 48 |
# File 'lib/immosquare-constants/ip.rb', line 46 def to_a [@local, @public, @client] end |
#to_h ⇒ Object
50 51 52 |
# File 'lib/immosquare-constants/ip.rb', line 50 def to_h to_hash end |
#to_hash ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/immosquare-constants/ip.rb', line 30 def to_hash { :local => @local, :public => @public, :client => @client } end |
#to_json ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/immosquare-constants/ip.rb', line 22 def to_json(*) { :local => @local, :public => @public, :client => @client }.to_json(*) end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/immosquare-constants/ip.rb', line 38 def to_s "local: #{@local}, public: #{@public}, client: #{@client}" end |