lib/mongoid/shell/properties/host.rb in mongoid-shell-0.1.0 vs lib/mongoid/shell/properties/host.rb in mongoid-shell-0.2.0

- old
+ new

@@ -1,14 +1,20 @@ module Mongoid module Shell module Properties module Host + attr_accessor :host + # database host def host - session.cluster.nodes.first.address + @host || begin + node = session.cluster.nodes.first + raise Mongoid::Shell::Errors::SessionNotConnectedError unless node + node.address == "localhost:27017" ? nil : node.address + end end end end end -end \ No newline at end of file +end