lib/mongoid/shell/properties/host.rb in mongoid-shell-0.4.3 vs lib/mongoid/shell/properties/host.rb in mongoid-shell-0.4.4
- old
+ new
@@ -7,26 +7,26 @@
# database host
if ::Mongoid::Compatibility::Version.mongoid3?
def host
@host || begin
node = session.cluster.nodes.first
- fail Mongoid::Shell::Errors::SessionNotConnectedError unless node
+ raise Mongoid::Shell::Errors::SessionNotConnectedError unless node
node.address == 'localhost:27017' ? nil : node.address
end
end
elsif ::Mongoid::Compatibility::Version.mongoid4?
def host
@host || begin
node = session.cluster.nodes.first
- fail Mongoid::Shell::Errors::SessionNotConnectedError unless node
+ raise Mongoid::Shell::Errors::SessionNotConnectedError unless node
node.address.original == 'localhost:27017' ? nil : node.address.original
end
end
else
def host
@host || begin
node = session.cluster.servers.first
- fail Mongoid::Shell::Errors::SessionNotConnectedError unless node
+ raise Mongoid::Shell::Errors::SessionNotConnectedError unless node
node.address.to_s == 'localhost:27017' ? nil : node.address.to_s
end
end
end
end