lib/neo4j/config.rb in neo4j-5.1.5 vs lib/neo4j/config.rb in neo4j-5.2.0

- old
+ new

@@ -1,22 +1,25 @@ module Neo4j # == Keeps configuration for neo4j # # == 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 + # In keeping with the Rails convention, this class writer lets you globally configure + # the incluse of timestamps on your nodes and rels. It defaults to false, requiring manual + # timestamp inclusion. + # @return [Boolean] the true/false value specified. + attr_writer :record_timestamps # @return [Fixnum] The location of the default configuration file. def default_file @default_file ||= DEFAULT_FILE end # Sets the location of the configuration YAML file and old deletes configurations. - # # @param [String] file_path represent the path to the file. def default_file=(file_path) delete_all @defaults = nil @default_file = File.expand_path(file_path) @@ -91,10 +94,16 @@ # @return [String] The config as a YAML def to_yaml configuration.to_yaml end + # @return [Boolean] The value of the config variable for including + # timestamps on all models. + def record_timestamps + @record_timestamps ||= false + end + def class_name_property @_class_name_property = Neo4j::Config[CLASS_NAME_PROPERTY_KEY] || :_classname end def include_root_in_json @@ -102,9 +111,14 @@ Neo4j::Config[:include_root_in_json].nil? ? true : Neo4j::Config[:include_root_in_json] end def module_handling Neo4j::Config[:module_handling] || :none + end + + # @return [Class] The configured timestamps type (e.g. Integer) or the default DateTime. + def timestamp_type + Neo4j::Config[:timestamp_type] || DateTime end def association_model_namespace Neo4j::Config[:association_model_namespace] || nil end