Module: Neo4j::Driver::Internal::Validator
- Defined in:
- lib/neo4j/driver/internal/validator.rb
Class Method Summary collapse
- .require_hash!(obj) ⇒ Object
- .require_hash_parameters!(parameters) ⇒ Object
- .require_non_nil!(obj, message = nil) ⇒ Object
- .require_non_nil_credentials!(username, password) ⇒ Object
Class Method Details
.require_hash!(obj) ⇒ Object
13 14 15 |
# File 'lib/neo4j/driver/internal/validator.rb', line 13 def self.require_hash!(obj) raise(ArgumentError, yield) unless obj.nil? || obj.is_a?(Hash) end |
.require_hash_parameters!(parameters) ⇒ Object
7 8 9 10 11 |
# File 'lib/neo4j/driver/internal/validator.rb', line 7 def self.require_hash_parameters!(parameters) require_hash!(parameters) do "The parameters should be provided as Map type. Unsupported parameters type: #{parameters.class.name}" end end |
.require_non_nil!(obj, message = nil) ⇒ Object
17 18 19 20 |
# File 'lib/neo4j/driver/internal/validator.rb', line 17 def self.require_non_nil!(obj, = nil) raise ArgumentError, [, "can't be nil"].compact.join(' ') if obj.nil? obj end |
.require_non_nil_credentials!(username, password) ⇒ Object
22 23 24 25 |
# File 'lib/neo4j/driver/internal/validator.rb', line 22 def self.require_non_nil_credentials!(username, password) require_non_nil! username, "Username" require_non_nil! password, "Password" end |