Class: Keymaker::Configuration
- Inherits:
-
Object
- Object
- Keymaker::Configuration
- Defined in:
- lib/keymaker/configuration.rb
Instance Attribute Summary collapse
-
#authentication ⇒ Object
Returns the value of attribute authentication.
-
#cypher_path ⇒ Object
Returns the value of attribute cypher_path.
-
#data_directory ⇒ Object
Returns the value of attribute data_directory.
-
#gremlin_path ⇒ Object
Returns the value of attribute gremlin_path.
-
#log_enabled ⇒ Object
Returns the value of attribute log_enabled.
-
#log_file ⇒ Object
Returns the value of attribute log_file.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#server ⇒ Object
Returns the value of attribute server.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #batch_node_path(node_id) ⇒ Object
- #batch_path ⇒ Object
- #connection_service_root_url ⇒ Object
- #connection_url_opts ⇒ Object
- #full_cypher_path ⇒ Object
- #full_gremlin_path ⇒ Object
-
#initialize(attrs = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #node_full_index_path(index_name, key, value, node_id) ⇒ Object
- #node_index_path(index_name) ⇒ Object
- #node_path ⇒ Object
- #node_properties_path(node_id) ⇒ Object
- #node_uri(node_id) ⇒ Object
- #path_traverse_node_path(node_id) ⇒ Object
- #relationship_path(relationship_id) ⇒ Object
- #relationships_path_for_node(node_id) ⇒ Object
- #service_root ⇒ Object
- #service_root_url ⇒ Object
- #url_opts ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/keymaker/configuration.rb', line 11 def initialize(attrs={}) self.protocol = attrs.fetch(:protocol) {'http'} self.server = attrs.fetch(:server) {'localhost'} self.port = attrs.fetch(:port) {7474} self.data_directory = attrs.fetch(:data_directory) {'db/data'} self.cypher_path = attrs.fetch(:cypher_path) {'cypher'} self.gremlin_path = attrs.fetch(:gremlin_path) {'ext/GremlinPlugin/graphdb/execute_script'} self.authentication = attrs.fetch(:authentication) {{}} self.username = attrs.fetch(:username) {nil} self.password = attrs.fetch(:password) {nil} end |
Instance Attribute Details
#authentication ⇒ Object
Returns the value of attribute authentication.
6 7 8 |
# File 'lib/keymaker/configuration.rb', line 6 def authentication @authentication end |
#cypher_path ⇒ Object
Returns the value of attribute cypher_path.
6 7 8 |
# File 'lib/keymaker/configuration.rb', line 6 def cypher_path @cypher_path end |
#data_directory ⇒ Object
Returns the value of attribute data_directory.
6 7 8 |
# File 'lib/keymaker/configuration.rb', line 6 def data_directory @data_directory end |
#gremlin_path ⇒ Object
Returns the value of attribute gremlin_path.
6 7 8 |
# File 'lib/keymaker/configuration.rb', line 6 def gremlin_path @gremlin_path end |
#log_enabled ⇒ Object
Returns the value of attribute log_enabled.
6 7 8 |
# File 'lib/keymaker/configuration.rb', line 6 def log_enabled @log_enabled end |
#log_file ⇒ Object
Returns the value of attribute log_file.
6 7 8 |
# File 'lib/keymaker/configuration.rb', line 6 def log_file @log_file end |
#logger ⇒ Object
Returns the value of attribute logger.
6 7 8 |
# File 'lib/keymaker/configuration.rb', line 6 def logger @logger end |
#password ⇒ Object
Returns the value of attribute password.
6 7 8 |
# File 'lib/keymaker/configuration.rb', line 6 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
6 7 8 |
# File 'lib/keymaker/configuration.rb', line 6 def port @port end |
#protocol ⇒ Object
Returns the value of attribute protocol.
6 7 8 |
# File 'lib/keymaker/configuration.rb', line 6 def protocol @protocol end |
#server ⇒ Object
Returns the value of attribute server.
6 7 8 |
# File 'lib/keymaker/configuration.rb', line 6 def server @server end |
#username ⇒ Object
Returns the value of attribute username.
6 7 8 |
# File 'lib/keymaker/configuration.rb', line 6 def username @username end |
Instance Method Details
#batch_node_path(node_id) ⇒ Object
70 71 72 |
# File 'lib/keymaker/configuration.rb', line 70 def batch_node_path(node_id) ["/node", node_id.to_s].join("/") end |
#batch_path ⇒ Object
74 75 76 |
# File 'lib/keymaker/configuration.rb', line 74 def batch_path [data_directory, "batch"].join("/") end |
#connection_service_root_url ⇒ Object
39 40 41 |
# File 'lib/keymaker/configuration.rb', line 39 def connection_service_root_url Addressable::URI.new(connection_url_opts) end |
#connection_url_opts ⇒ Object
43 44 45 46 47 48 |
# File 'lib/keymaker/configuration.rb', line 43 def connection_url_opts url_opts.tap do |url_opts| url_opts[:user] = username if username url_opts[:password] = password if password end end |
#full_cypher_path ⇒ Object
50 51 52 |
# File 'lib/keymaker/configuration.rb', line 50 def full_cypher_path [service_root, data_directory, cypher_path].join("/") end |
#full_gremlin_path ⇒ Object
54 55 56 |
# File 'lib/keymaker/configuration.rb', line 54 def full_gremlin_path [service_root, data_directory, gremlin_path].join("/") end |
#node_full_index_path(index_name, key, value, node_id) ⇒ Object
86 87 88 |
# File 'lib/keymaker/configuration.rb', line 86 def node_full_index_path(index_name, key, value, node_id) [node_index_path(index_name), key, value, node_id].join("/") end |
#node_index_path(index_name) ⇒ Object
90 91 92 |
# File 'lib/keymaker/configuration.rb', line 90 def node_index_path(index_name) [data_directory, "index", "node", index_name.to_s].join("/") end |
#node_path ⇒ Object
58 59 60 |
# File 'lib/keymaker/configuration.rb', line 58 def node_path [data_directory, "node"].join("/") end |
#node_properties_path(node_id) ⇒ Object
62 63 64 |
# File 'lib/keymaker/configuration.rb', line 62 def node_properties_path(node_id) [node_path, node_id.to_s, "properties"].join("/") end |
#node_uri(node_id) ⇒ Object
94 95 96 |
# File 'lib/keymaker/configuration.rb', line 94 def node_uri(node_id) [service_root, node_path, node_id.to_s].join("/") end |
#path_traverse_node_path(node_id) ⇒ Object
66 67 68 |
# File 'lib/keymaker/configuration.rb', line 66 def path_traverse_node_path(node_id) [node_path, node_id.to_s, "traverse", "path"].join("/") end |
#relationship_path(relationship_id) ⇒ Object
78 79 80 |
# File 'lib/keymaker/configuration.rb', line 78 def relationship_path(relationship_id) [data_directory, "relationship", relationship_id.to_s].join("/") end |
#relationships_path_for_node(node_id) ⇒ Object
82 83 84 |
# File 'lib/keymaker/configuration.rb', line 82 def relationships_path_for_node(node_id) [node_path, node_id.to_s, "relationships"].join("/") end |
#service_root ⇒ Object
23 24 25 |
# File 'lib/keymaker/configuration.rb', line 23 def service_root service_root_url.to_s end |
#service_root_url ⇒ Object
27 28 29 |
# File 'lib/keymaker/configuration.rb', line 27 def service_root_url Addressable::URI.new(url_opts) end |
#url_opts ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/keymaker/configuration.rb', line 31 def url_opts {}.tap do |url_opts| url_opts[:scheme] = protocol url_opts[:host] = server url_opts[:port] = port end end |