Add nice inspect results for Environment and Machine

This commit is contained in:
Mitchell Hashimoto 2012-08-10 00:38:11 -07:00
parent 64afd578b3
commit 2e25285297
2 changed files with 16 additions and 0 deletions

View File

@ -104,6 +104,14 @@ module Vagrant
activate_plugins
end
# Return a human-friendly string for pretty printed or inspected
# instances.
#
# @return [String]
def inspect
"#<#{self.class}: #{@cwd}>"
end
#---------------------------------------------------------------
# Helpers
#---------------------------------------------------------------

View File

@ -151,6 +151,14 @@ module Vagrant
@id = value
end
# This returns a clean inspect value so that printing the value via
# a pretty print (`p`) results in a readable value.
#
# @return [String]
def inspect
"#<#{self.class}: #{@name} (#{@provider.class})>"
end
# This returns the SSH info for accessing this machine. This SSH info
# is queried from the underlying provider. This method returns `nil` if
# the machine is not ready for SSH communication.