Skip to content

Commit

Permalink
Revert "bundle update"
Browse files Browse the repository at this point in the history
This reverts commit 3e1a21c.
  • Loading branch information
murb committed Jan 7, 2024
1 parent 3e1a21c commit f7e7c58
Show file tree
Hide file tree
Showing 27 changed files with 201 additions and 214 deletions.
328 changes: 157 additions & 171 deletions Gemfile.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions app/controllers/batch/base_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def removable_fields
end

def strategy_attribute_for(field_name)
:"update_#{field_name}_strategy"
"update_#{field_name}_strategy".to_sym
end

def strategies_for(field_name)
Expand All @@ -50,7 +50,7 @@ def strategies_for(field_name)

def default_to_ignore!
self.class.batch_fields.each do |field_name|
send(:"#{self.class.strategy_attribute_for(field_name)}=", :IGNORE) if send(self.class.strategy_attribute_for(field_name)).nil?
send("#{self.class.strategy_attribute_for(field_name)}=", :IGNORE) if send(self.class.strategy_attribute_for(field_name)).nil?
end
end

Expand Down
8 changes: 4 additions & 4 deletions app/controllers/concerns/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,23 @@ def authentication_callbacks
end

def named_collection_url
@collection ? send(:"collection_#{controlled_class.table_name}_url", @collection) : send(:"#{controlled_class.table_name}_url")
@collection ? send("collection_#{controlled_class.table_name}_url", @collection) : send("#{controlled_class.table_name}_url")
end

def singularized_name
controlled_class.table_name.singularize
end

def named_collection_variable= values
instance_variable_set(:"@#{controlled_class.table_name}", values)
instance_variable_set("@#{controlled_class.table_name}", values)
end

def named_variable= value
instance_variable_set(:"@#{singularized_name}", value)
instance_variable_set("@#{singularized_name}", value)
end

def named_variable
instance_variable_get(:"@#{singularized_name}")
instance_variable_get("@#{singularized_name}")
end

def set_named_variable_by_class
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/works/zip_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def show_zip_response
@works.each do |work|
base_file_name = work.base_file_name
file_editions.each do |field|
if work.send(:"#{field}?")
if work.send("#{field}?".to_sym)
filename_components = [base_file_name]
filename_components << field.gsub("photo_", "") unless only_front
filename = "#{filename_components.join("_")}.jpg"
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ def works_modified_forms_path options = {}
def link_to_edit item
if item.is_a? Array
item_part = item.collect { |a| a.class.model_name.singular }.join("_")
url = send(:"edit_#{item_part}_path", *item)
url = send("edit_#{item_part}_path".to_sym, *item)
name = item.last.name
else
url = send(:"edit_#{item.class.model_name.singular}_path", item)
url = send("edit_#{item.class.model_name.singular}_path".to_sym, item)
name = item.name
end
link_to name, url
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/works_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def filter_hidden field_name
def options_from_aggregation_for_select aggregation, selected = nil
html = ""
aggregation.each do |k, v|
selected_true = selected && (selected == k) || (selected.methods.include?(:include?) && selected.collect { |a| a.to_param }.include?(k.to_param))
selected_true = (selected && (selected == k) || (selected.methods.include?(:include?) && selected.collect { |a| a.to_param }.include?(k.to_param)))
html += "<option value=\"#{k.to_param}\""
html += "selected=\"selected\"" if selected_true
html += ">#{v[:name]}</option>"
Expand Down
2 changes: 1 addition & 1 deletion app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def initialize(user)
alias_action :read_location, :edit_location, to: :manage_location

# default role settings
send(:"initialize_#{user.role}")
send("initialize_#{user.role}")

# specific cross role functionality
message_rules
Expand Down
6 changes: 3 additions & 3 deletions app/models/artist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ def to_parameters
def import!(other)
other.to_parameters.each do |k, v|
skip_name_fields = prefix? || artist_name?
empty_value = v.nil? || v.to_s.empty?
name_fields = (k == "first_name") || (k == "last_name")
empty_value = (v.nil? || v.to_s.empty?)
name_fields = ((k == "first_name") || (k == "last_name"))

if !empty_value && !(name_fields && skip_name_fields)
send(:"#{k}=", v)
send("#{k}=".to_sym, v)
end
end
educational_involvements = []
Expand Down
2 changes: 1 addition & 1 deletion app/models/batch_photo_upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def couple!
if image.file_exists? && image.work
attribute = image.image_type
work = image.work
work.send(:"#{attribute}=", image.file)
work.send("#{attribute}=".to_sym, image.file)
work.save
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/collection/hierarchy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def expand_with_child_collections(depth = 5)
joins(join_sql)
.select(select_sql)
.each do |intermediate_result|
(depth + 1).times { |a| ids << intermediate_result.send(:"_child_level#{a}") }
(depth + 1).times { |a| ids << intermediate_result.send("_child_level#{a}".to_sym) }
end
::Collection.unscoped.where(id: ids.compact.uniq)
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/fast_aggregatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def fast_aggregations attributes
end
private def _fast_aggregate_column_values rv, attribute
self.select(attribute).group(attribute).collect { |a| a.send(attribute) }.sort_by(&:to_s).each do |a|
value = a || Work::Search::NOT_SET_VALUE
value = (a || Work::Search::NOT_SET_VALUE)
if value.is_a? String
if attribute == :grade_within_collection
value = value[0]
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/has_collection_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def collection_attributes_attributes= collection_attribute_params
# for new and create actions
def populate_collection_attributes(collection:)
collection = collection.base_collection
default_collection_attributes = collection.send(:"default_collection_attributes_for_#{self.class.table_name}")&.select(&:present?)
default_collection_attributes = collection.send("default_collection_attributes_for_#{self.class.table_name}")&.select(&:present?)
default_collection_languages = collection.supported_languages&.select(&:present?) || [:nl]

default_collection_attributes&.each do |attribute_type|
Expand Down
4 changes: 2 additions & 2 deletions app/models/concerns/method_cache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def has_cache_for_method(*method_names)
# end
# end

define_method(:"cache_#{method_name}!") do |update_column = false|
define_method("cache_#{method_name}!") do |update_column = false|
new_cache_value = send(method_name).to_json
if update_column
update_column("#{method_name}_cache", new_cache_value)
Expand All @@ -31,7 +31,7 @@ def has_cache_for_method(*method_names)
end
end

define_method(:"cached_#{method_name}") do # |arg=nil| # default arg to allow before_blah callbacks
define_method("cached_#{method_name}") do # |arg=nil| # default arg to allow before_blah callbacks
column_value = read_attribute("#{method_name}_cache")
JSON.parse(column_value) if column_value
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/o_auth_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def oauthable?
end

def oauth_strategy
@oauth_strategy ||= "::OmniAuth::Strategies::#{oauth_provider.classify}".constantize.new(name, Rails.application.secrets.send(:"#{oauth_provider}_id"), Rails.application.secrets.send(:"#{oauth_provider}_secret"), client_options: {site: Rails.application.secrets.send(:"#{oauth_provider}_site")})
@oauth_strategy ||= "::OmniAuth::Strategies::#{oauth_provider.classify}".constantize.new(name, Rails.application.secrets.send("#{oauth_provider}_id"), Rails.application.secrets.send("#{oauth_provider}_secret"), client_options: {site: Rails.application.secrets.send("#{oauth_provider}_site")})
end

def client
Expand Down
2 changes: 1 addition & 1 deletion app/models/import_collection/class_association.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class ImportCollection::ClassAssociation

def initialize(options = {})
options.each do |k, v|
send(:"#{k}=", v)
send("#{k}=", v)
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/import_collection/workbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def analyze_field_properties(field)
column = Work.columns.find { |a| a.name == property.to_s }
if column
field_type = column.type
elsif Work.instance_methods.include?(fieldname.to_sym) && Work.instance_methods.include?(:"#{fieldname}=")
elsif Work.instance_methods.include?(fieldname.to_sym) && Work.instance_methods.include?("#{fieldname}=".to_sym)
field_type = Work.new.send(fieldname).class
end
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/location.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ def name= name
return if name.blank?
name_split = name.split(NAME_SPLITTER)
if name_split.size > 1 && !persisted?
super(name_split[0].strip)
super name_split[0].strip
self.address = name_split[1...].map(&:strip).join("\n").strip
else
super(name.strip)
super name.strip
end
end

Expand Down
6 changes: 3 additions & 3 deletions app/models/report/builder_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def basic_aggregation_snippet key, postfix = "", field = nil, missing = nil
rv = {
key.to_sym => {
terms: {
field: field || "#{key}#{postfix}", size: 999
field: (field || "#{key}#{postfix}"), size: 999
}
}
}
Expand All @@ -16,9 +16,9 @@ def basic_aggregation_snippet key, postfix = "", field = nil, missing = nil

def basic_aggregation_snippet_with_missing key, postfix = "", field = nil
rv = basic_aggregation_snippet(key, postfix, field)
rv[:"#{key}_missing"] = {
rv["#{key}_missing".to_sym] = {
missing: {
field: field || "#{key}#{postfix}"
field: (field || "#{key}#{postfix}")
}
}
rv
Expand Down
2 changes: 1 addition & 1 deletion app/models/simple_artist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def id

def initialize kvs = {}
kvs.each do |k, v|
send(:"#{k}=", v)
send("#{k}=", v)
end
end

Expand Down
7 changes: 4 additions & 3 deletions app/models/time_span.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class TimeSpan < ApplicationRecord
(time_spans.starts_at <= :start AND time_spans.ends_at IS NULL) OR
(time_spans.starts_at > :start AND time_spans.starts_at < :end) OR
(time_spans.starts_at <= :start AND time_spans.status = 'active')
", {start: period.begin || 2000.years.ago, end: period.end || 2000.years.from_now})
", {start: (period.begin || 2000.years.ago), end: (period.end || 2000.years.from_now)})
}
scope :current, -> { period(Time.now...Time.now) }
scope :sold, -> { where(status: [:active, :finished]).where(classification: :purchase) }
Expand Down Expand Up @@ -143,12 +143,13 @@ def next_time_span

def current?
current_time = Time.current

(starts_at.nil? && ends_at.nil?) or
(
(starts_at.nil? && ends_at.nil?) or
(starts_at.nil? && ends_at > current_time) or
(ends_at.nil? && starts_at <= current_time) or
(starts_at <= current_time && ends_at > current_time) or
(starts_at <= current_time && status == "active")
)
end

def status= new_status
Expand Down
6 changes: 3 additions & 3 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ def accessible_contacts
end

def accessible_roles
@accessible_roles ||= User::ROLES.select { |role| ability.can?(:"update_#{role}", User) }
@accessible_roles ||= User::ROLES.select { |role| ability.can?("update_#{role}".to_sym, User) }
end

def role= new_role
User::ROLES.each do |r|
send(:"#{r}=", r.to_s == new_role.to_s) if methods.include?(r)
send("#{r}=", r.to_s == new_role.to_s) if methods.include?(r)
end
role
end
Expand Down Expand Up @@ -252,7 +252,7 @@ def messages_sent
def reset_all_roles
ROLES.each do |role|
unless role == :read_only # "default" role
send(:"#{role}=", false)
send("#{role}=", false)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/work.rb
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ def quick_destroy_all
end

def human_attribute_name_for_alt_number_field(field_name, collection)
custom_label_name = collection&.send(:"label_override_work_#{field_name}_with_inheritance")
custom_label_name = collection&.send("label_override_work_#{field_name}_with_inheritance".to_sym)
custom_label_name || Work.human_attribute_name(field_name)
end

Expand Down
2 changes: 1 addition & 1 deletion app/models/work/time_spans.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def availability_status
end

def current_active_time_span
@current_active_time_span ||= time_spans.reverse.find(&:current_and_active?) || time_spans.reverse.find(&:current_and_active_or_reserved?)
@current_active_time_span ||= (time_spans.reverse.find(&:current_and_active?) || time_spans.reverse.find(&:current_and_active_or_reserved?))
end

def last_active_time_span
Expand Down
2 changes: 1 addition & 1 deletion app/workers/update_cache_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def perform(class_name, field_name, id = nil)
konstant.pluck(:id).each { |obj_id| UpdateCacheWorker.perform_async(class_name, field_name, obj_id) }
else
objekt = class_name.constantize.find(id)
objekt.send(:"cache_#{field_name}!", true) # updates the cache using update_column
objekt.send("cache_#{field_name}!", true) # updates the cache using update_column
end
end
end
2 changes: 1 addition & 1 deletion config/initializers/attr_localized.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def self.attr_localized(*fields)
separator = I18n.t("number.format.separator")

fields.each do |field|
define_method(:"#{field}=") do |value|
define_method("#{field}=") do |value|
self[field] = if value.is_a?(String)
value.gsub(Regexp.new("(\\#{delimiter}(\\d\\d\\d))"), '\2').sub(separator, ".")
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def self.up
columns = [:location, :stock_number, :alt_number_1, :alt_number_2, :alt_number_3, :photo_front, :photo_back, :photo_detail_1, :photo_detail_2, :title, :print, :grade_within_collection, :entry_status, :abstract_or_figurative, :location_detail]
Work.all.each do |a|
columns.each do |c|
a.send(:"#{c}=", nil) if a.send(c).to_s.strip == ""
a.send("#{c}=".to_sym, nil) if a.send(c).to_s.strip == ""
end
a.save
end
Expand Down
6 changes: 3 additions & 3 deletions spec/requests/name_id_editor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
constant = name_id_admin_resource.singularize.camelize.constantize

describe "GET /#{name_id_admin_resource}" do
let(:path) { send(:"#{name_id_admin_resource}_path") }
let(:path) { send("#{name_id_admin_resource}_path") }

it "ignores anonymous request" do
get path
Expand All @@ -40,7 +40,7 @@
end
end
describe "GET /#{name_id_admin_resource}/new" do
let(:path) { send(:"new_#{name_id_admin_resource.singularize}_path") }
let(:path) { send("new_#{name_id_admin_resource.singularize}_path") }

it "ignores anonymous request" do
get path
Expand All @@ -59,7 +59,7 @@
end

describe "POST /#{name_id_admin_resource}" do
let(:path) { send(:"#{name_id_admin_resource}_path") }
let(:path) { send("#{name_id_admin_resource}_path") }

it "does not change #{constant}.count when performed by anonymous" do
expect {
Expand Down

0 comments on commit f7e7c58

Please sign in to comment.