if request.post?
setting = params[:settings] ? params[:settings].permit!.to_h : {}
- Setting.send "plugin_#{@plugin.id}=", setting
+ Setting.send :"plugin_#{@plugin.id}=", setting
flash[:notice] = l(:notice_successful_update)
redirect_to plugin_settings_path(@plugin)
else
@partial = @plugin.settings[:partial]
- @settings = Setting.send "plugin_#{@plugin.id}"
+ @settings = Setting.send :"plugin_#{@plugin.id}"
end
rescue Redmine::PluginNotFound
render_404
# Render the error messages for the given objects
def error_messages_for(*objects)
- objects = objects.filter_map {|o| o.is_a?(String) ? instance_variable_get("@#{o}") : o}
+ objects = objects.filter_map {|o| o.is_a?(String) ? instance_variable_get(:"@#{o}") : o}
errors = objects.map {|o| o.errors.full_messages}.flatten
render_error_messages(errors)
end
return nil
end
else
- send "render_#{block_definition[:name]}_block", block, settings
+ send :"render_#{block_definition[:name]}_block", block, settings
end
end
# Returns true if this source can be searched for users
def searchable?
- !account.to_s.include?("$login") && %w(login firstname lastname mail).all? {|a| send("attr_#{a}?")}
+ !account.to_s.include?("$login") && %w(login firstname lastname mail).all? {|a| send(:"attr_#{a}?")}
end
# Searches the source for users and returns an array of results
def send_notification
event = "#{commented.class.name.underscore}_comment_added"
if Setting.notified_events.include?(event)
- Mailer.public_send("deliver_#{event}", self)
+ Mailer.public_send(:"deliver_#{event}", self)
end
end
end
def initialize(attributes={})
attributes.each do |name, v|
- send "#{name}=", v
+ send :"#{name}=", v
end
end
def do_callbacks(position, object)
if callbacks = (settings['callbacks'] || {}).delete(position)
callbacks.each do |name, args|
- send "#{name}_callback", object, *args
+ send :"#{name}_callback", object, *args
end
save!
end
%w(project project_id tracker tracker_id).each do |attr|
if attrs.has_key?(attr)
- send "#{attr}=", attrs.delete(attr)
+ send :"#{attr}=", attrs.delete(attr)
end
end
super(attrs, *args)
def clear_disabled_fields
if tracker
tracker.disabled_core_fields.each do |attribute|
- send "#{attribute}=", nil
+ send :"#{attribute}=", nil
end
self.priority_id ||= IssuePriority.default&.id || IssuePriority.active.first.id
self.done_ratio ||= 0
def self.assign_string_attribute_with_limit(object, attribute, value, limit=nil)
limit ||= object.class.columns_hash[attribute.to_s].limit || 255
value = value.to_s.slice(0, limit)
- object.send("#{attribute}=", value)
+ object.send(:"#{attribute}=", value)
end
private_class_method :assign_string_attribute_with_limit
end
to_be_copied.each do |name|
- send "copy_#{name}", project
+ send :"copy_#{name}", project
end
Redmine::Hook.call_hook(:model_project_copy_before_save,
:source_project => project,
custom_field = column.custom_field
send :total_for_custom_field, custom_field, scope
else
- send "total_for_#{column.name}", scope
+ send :"total_for_#{column.name}", scope
end
rescue ::ActiveRecord::StatementInvalid => e
raise StatementInvalid.new(e.message)
/\s*,\s*/]
].each do |enable_regex, regex_field, delimiter|
if settings.key?(regex_field) || settings.key?(enable_regex)
- regexp = Setting.send("#{enable_regex}?")
+ regexp = Setting.send(:"#{enable_regex}?")
if settings.key?(enable_regex)
regexp = settings[enable_regex].to_s != '0'
end
transaction do
all.each do |object|
clear = object.send(attribute)
- object.send "#{attribute}=", clear
+ object.send :"#{attribute}=", clear
raise(ActiveRecord::Rollback) unless object.save(validate: false)
end
end ? true : false
"Please update your config/configuration.yml to use :#$1 delivery method instead."
end
v.symbolize_keys! if v.respond_to?(:symbolize_keys!)
- ActionMailer::Base.send("#{k}=", v)
+ ActionMailer::Base.send(:"#{k}=", v)
end
end
def render_object_row(object, options)
class_name = object.class.name.downcase
- send("subject_for_#{class_name}", object, options) unless options[:only] == :lines || options[:only] == :selected_columns
- send("line_for_#{class_name}", object, options) unless options[:only] == :subjects || options[:only] == :selected_columns
+ send(:"subject_for_#{class_name}", object, options) unless options[:only] == :lines || options[:only] == :selected_columns
+ send(:"line_for_#{class_name}", object, options) unless options[:only] == :subjects || options[:only] == :selected_columns
column_content_for_issue(object, options) if options[:only] == :selected_columns && options[:column].present? && object.is_a?(Issue)
options[:top] += options[:top_increment]
@number_of_rows += 1
end
def subject(label, options, object=nil)
- send "#{options[:format]}_subject", options, label, object
+ send :"#{options[:format]}_subject", options, label, object
end
def line(start_date, end_date, done_ratio, markers, label, options, object=nil)
options[:zoom] ||= 1
options[:g_width] ||= (self.date_to - self.date_from + 1) * options[:zoom]
coords = coordinates(start_date, end_date, done_ratio, options[:zoom])
- send "#{options[:format]}_task", options, coords, markers, label, object
+ send :"#{options[:format]}_task", options, coords, markers, label, object
end
# Generates a gantt image
class_eval do
names.each do |name|
define_method(name) do |*args|
- args.empty? ? instance_variable_get("@#{name}") : instance_variable_set("@#{name}", *args)
+ args.empty? ? instance_variable_get(:"@#{name}") : instance_variable_set(:"@#{name}", *args)
end
end
end
# #=>"<h1>A <b>bold</b> man</h1>"
#
def initialize( string, restrictions = [] )
- restrictions.each { |r| method( "#{r}=" ).call( true ) }
+ restrictions.each { |r| method( :"#{r}=" ).call( true ) }
super( string )
end
# pass to prefix handler
replacement = nil
- if respond_to? "textile_#{tag}", true
- replacement = method( "textile_#{tag}" ).call( tag, atts, cite, content )
- elsif respond_to? "textile_#{tagpre}_", true
- replacement = method( "textile_#{tagpre}_" ).call( tagpre, num, atts, cite, content )
+ if respond_to? :"textile_#{tag}", true
+ replacement = method( :"textile_#{tag}" ).call( tag, atts, cite, content )
+ elsif respond_to? :"textile_#{tagpre}_", true
+ replacement = method( :"textile_#{tagpre}_" ).call( tagpre, num, atts, cite, content )
end
text.gsub!( $& ) { replacement } if replacement
end
assert_equal 'example1@redmine.org', attributes[:mail]
assert_equal auth.id, attributes[:auth_source_id]
attributes.each_key do |attribute|
- assert User.new.respond_to?("#{attribute}="), "Unexpected :#{attribute} attribute returned"
+ assert User.new.respond_to?(:"#{attribute}="), "Unexpected :#{attribute} attribute returned"
end
end
class Base
def attributes=(attrs)
attrs.each do |key, value|
- send("#{key}=", value)
+ send(:"#{key}=", value)
end
end
end