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) ⇒ 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) ⇒ Object
17 18 19 |
# File 'lib/neo4j/driver/internal/validator.rb', line 17 def self.require_non_nil!(obj, ) raise ArgumentError, "#{} can't be nil" if obj.nil? end |
.require_non_nil_credentials!(username, password) ⇒ Object
21 22 23 24 |
# File 'lib/neo4j/driver/internal/validator.rb', line 21 def self.require_non_nil_credentials!(username, password) require_non_nil! username, "Username" require_non_nil! password, "Password" end |