Class: GuessOS::Host
- Inherits:
-
Object
- Object
- GuessOS::Host
- Defined in:
- lib/guess_os/host.rb
Instance Attribute Summary collapse
-
#ip ⇒ Object
readonly
Returns the value of attribute ip.
-
#os ⇒ Object
readonly
Returns the value of attribute os.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Host
constructor
A new instance of Host.
- #local? ⇒ Boolean
- #remote? ⇒ Boolean
Constructor Details
#initialize(args = {}) ⇒ Host
Returns a new instance of Host.
8 9 10 11 12 13 14 |
# File 'lib/guess_os/host.rb', line 8 def initialize(args = {}) @ip = args[:ip] || "localhost" @port = args[:port] || "22" @username = args[:username] || "vagrant" @password = args[:password] || "vagrant" @os = GuessOS::Type.guess(self) end |
Instance Attribute Details
#ip ⇒ Object (readonly)
Returns the value of attribute ip.
5 6 7 |
# File 'lib/guess_os/host.rb', line 5 def ip @ip end |
#os ⇒ Object (readonly)
Returns the value of attribute os.
6 7 8 |
# File 'lib/guess_os/host.rb', line 6 def os @os end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
5 6 7 |
# File 'lib/guess_os/host.rb', line 5 def password @password end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/guess_os/host.rb', line 5 def port @port end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
5 6 7 |
# File 'lib/guess_os/host.rb', line 5 def username @username end |
Class Method Details
.unkown ⇒ Object
26 27 28 |
# File 'lib/guess_os/host.rb', line 26 def self.unkown GuessOS::OS.new(:unkown, :unkown, "Unkown") end |
Instance Method Details
#local? ⇒ Boolean
16 17 18 19 20 |
# File 'lib/guess_os/host.rb', line 16 def local? return true if (ip == "localhost") || (ip == "127.0.0.1") false end |
#remote? ⇒ Boolean
22 23 24 |
# File 'lib/guess_os/host.rb', line 22 def remote? !local? end |