lib/active_notifier/configurable.rb in active_notifier-0.3.0 vs lib/active_notifier/configurable.rb in active_notifier-0.4.0
- old
+ new
@@ -33,12 +33,13 @@
# ActiveNotifier.config.const_name = :Message
# ::Message == ::ActiveNotifier # => true
def const_name=(const_name)
const_name = const_name.to_sym
const_name = :Notifier if const_name.empty?
- error_message = "const_name is already defined, please set another value"
- raise ActiveNotifier::ConfigureError, error_message if Kernel.const_defined?(const_name)
+ if Kernel.const_defined?(const_name)
+ raise ActiveNotifier::ConfigureError, "const_name is already defined, please set another value"
+ end
Kernel.const_set(const_name, ActiveNotifier)
@const_name = const_name
end
# Message Adapter
@@ -60,11 +61,11 @@
def channel_tokens
@channel_tokens || {}
end
# Set the tokens of channel
- # @param channel_tokens [Hash] ({})
+ # @param channel_tokens [#to_h] ({})
# @example
# ActiveNotifier.config.channel_tokens = {
# default: "xxx",
# order: "xxx"
# }
@@ -77,10 +78,10 @@
def template_home
@template_home || "#{File.expand_path(__dir__)}/templates"
end
# Set the template home directory
- # @param template_home [String] (lib/active_notifier/templates)
+ # @param template_home [#to_s] (lib/active_notifier/templates)
def template_home=(template_home)
template_home = template_home.to_s
raise ActiveNotifier::ConfigureError, "template_home value can't be blank" if template_home.empty?
@template_home = template_home
end