lib/dynamoid/config/options.rb in dynamoid-0.2.0 vs lib/dynamoid/config/options.rb in dynamoid-0.3.0
- old
+ new
@@ -9,10 +9,12 @@
#
# @example Get the defaults.
# options.defaults
#
# @return [ Hash ] The default options.
+ #
+ # @since 0.2.0
def defaults
@defaults ||= {}
end
# Define a configuration option with a default.
@@ -22,10 +24,12 @@
#
# @param [ Symbol ] name The name of the configuration option.
# @param [ Hash ] options Extras for the option.
#
# @option options [ Object ] :default The default value.
+ #
+ # @since 0.2.0
def option(name, options = {})
defaults[name] = settings[name] = options[:default]
class_eval <<-RUBY
def #{name}
@@ -50,19 +54,23 @@
#
# @example Reset the configuration options.
# config.reset
#
# @return [ Hash ] The defaults.
+ #
+ # @since 0.2.0
def reset
settings.replace(defaults)
end
# Get the settings or initialize a new empty hash.
#
# @example Get the settings.
# options.settings
#
# @return [ Hash ] The setting options.
+ #
+ # @since 0.2.0
def settings
@settings ||= {}
end
end
end