lib/neo4j/config.rb in neo4j-4.1.5 vs lib/neo4j/config.rb in neo4j-5.0.0.rc.1

- old
+ new

@@ -3,10 +3,11 @@ # # == Configurations keys # class Config DEFAULT_FILE = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'config', 'neo4j', 'config.yml')) + CLASS_NAME_PROPERTY_KEY = 'class_name_property' class << self # @return [Fixnum] The location of the default configuration file. def default_file @default_file ||= DEFAULT_FILE @@ -51,44 +52,39 @@ @configuration ||= ActiveSupport::HashWithIndifferentAccess.new yield @configuration nil end - # Sets the value of a config entry. # # @param [Symbol] key the key to set the parameter for # @param val the value of the parameter. def []=(key, val) configuration[key.to_s] = val end - # @param [Symbol] key The key of the config entry value we want # @return the the value of a config entry def [](key) configuration[key.to_s] end - # Remove the value of a config entry. # # @param [Symbol] key the key of the configuration entry to delete # @return The value of the removed entry. def delete(key) configuration.delete(key) end - # Remove all configuration. This can be useful for testing purpose. # # @return nil def delete_all @configuration = nil end - # @return [Hash] The config as a hash. def to_hash configuration.to_hash end @@ -96,15 +92,29 @@ def to_yaml configuration.to_yaml end def class_name_property - Neo4j::Config[:class_name_property] || :_classname + @_class_name_property = Neo4j::Config[CLASS_NAME_PROPERTY_KEY] || :_classname end def include_root_in_json # we use ternary because a simple || will always evaluate true Neo4j::Config[:include_root_in_json].nil? ? true : Neo4j::Config[:include_root_in_json] + end + + def module_handling + Neo4j::Config[:module_handling] || :none + end + + def association_model_namespace + Neo4j::Config[:association_model_namespace] || nil + end + + def association_model_namespace_string + namespace = Neo4j::Config[:association_model_namespace] + return nil if namespace.nil? + "::#{namespace}" end end end end