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
-
#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.
15 16 17 18 19 |
# File 'lib/immosquare-constants/ip.rb', line 15 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.
13 14 15 |
# File 'lib/immosquare-constants/ip.rb', line 13 def client @client end |
#local ⇒ Object (readonly)
Returns the value of attribute local.
13 14 15 |
# File 'lib/immosquare-constants/ip.rb', line 13 def local @local end |
#public ⇒ Object (readonly)
Returns the value of attribute public.
13 14 15 |
# File 'lib/immosquare-constants/ip.rb', line 13 def public @public end |
Instance Method Details
#inspect ⇒ Object
41 42 43 |
# File 'lib/immosquare-constants/ip.rb', line 41 def inspect "#<ImmosquareConstants::Ip::IpResult local: #{@local.inspect}, public: #{@public.inspect}, client: #{@client.inspect}>" end |
#to_a ⇒ Object
45 46 47 |
# File 'lib/immosquare-constants/ip.rb', line 45 def to_a [@local, @public, @client] end |
#to_h ⇒ Object
49 50 51 |
# File 'lib/immosquare-constants/ip.rb', line 49 def to_h to_hash end |
#to_hash ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/immosquare-constants/ip.rb', line 29 def to_hash { :local => @local, :public => @public, :client => @client } end |
#to_json ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/immosquare-constants/ip.rb', line 21 def to_json(*) { :local => @local, :public => @public, :client => @client }.to_json(*) end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/immosquare-constants/ip.rb', line 37 def to_s "local: #{@local}, public: #{@public}, client: #{@client}" end |