lib/rgentpl/core/configuration.rb in rgentpl-1.2.6 vs lib/rgentpl/core/configuration.rb in rgentpl-2.0.0
- old
+ new
@@ -22,42 +22,42 @@
# Interface for adding new attribute in configuration block
#
# @param exc [NoMethodError] the exception
# @return [void]
def add_new_attribute_from_exception(exc)
- add_new_attribute(exc, exc.name.to_s.gsub(/=$/, ''))
+ add_new_attribute(exc, exc.name.to_s.gsub(/=$/, ""))
end
# Implementation for adding new attribute in configuration block
#
# @param exc [NoMethodError] the exception
# @param method [String] the writter method name
# @return [void]
def add_new_attribute(exc, method)
@config.extend Virtus.model
@config.attribute method.to_sym, String, default: exc.args.first,
- lazy: true
+ lazy: true
@config.send(exc.name, exc.args.first)
end
private :add_new_attribute
end
# Configuration
class Configuration
include Virtus.model
- attribute :active, Boolean, default: true
+ attribute :active, Boolean, default: true
attribute :log_file, String
- attribute :options, Hash[Symbol => String], default: {}
+ attribute(:options, {Symbol => String}, default: {})
# Set custom default values
#
# @param args [Array] the attributes
# @return [void]
def initialize(*args)
super
# Bug - Update some default values
- @log_file = Rgentpl.env + '.log'
+ @log_file = Rgentpl.env + ".log"
end
# Configuration
#
# @return [Rgentpl::Configuration] the configuration