Skip to content

Commit

Permalink
Merge pull request #1 from 10Pines/ruby31
Browse files Browse the repository at this point in the history
chore: support ruby3.1 by changing yaml load mechanism
  • Loading branch information
ngarbezza authored Dec 5, 2024
2 parents bcb6a4e + f599c26 commit 3e9a2df
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions lib/will_filter/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def self.init(site_current_user, site_current_project = nil)
Thread.current[:current_user] = site_current_user
Thread.current[:current_project] = site_current_project
end

def self.current_user
Thread.current[:current_user]
end
Expand All @@ -49,16 +49,16 @@ def self.reset!
Thread.current[:current_user] = nil
Thread.current[:current_project] = nil
end

def self.load_yml(file_path)
yml = YAML.load_file("#{Rails.root}#{file_path}")[Rails.env]
yml = YAML.unsafe_load_file("#{Rails.root}#{file_path}")[Rails.env]
HashWithIndifferentAccess.new(yml)
end

def self.config
@config ||= load_yml("/config/will_filter/config.yml")
end

def self.require_filter_extensions?
config[:require_filter_extensions]
end
Expand All @@ -70,47 +70,47 @@ def self.disable_filter_saving?
def self.effects_options
config[:effects_options]
end

def self.save_options
config[:save_options]
end

def self.export_options
config[:export_options]
end

def self.containers
config[:containers]
end

def self.data_types
config[:data_types]
end

def self.operators
config[:operators]
end

def self.operator_order
@operator_order ||= begin
keys = operators.keys
keys.sort! { |a,b| operators[a] <=> operators[b] }
keys
end
end

def self.saving_enabled?
save_options[:enabled]
end

def self.user_filters_enabled?
save_options[:user_filters_enabled]
end

def self.user_class_name
save_options[:user_class_name]
end

def self.current_user_method
save_options[:current_user_method]
end
Expand All @@ -130,7 +130,7 @@ def self.current_project_method
def self.exporting_enabled?
export_options[:enabled]
end

def self.default_export_formats
export_options[:default_formats]
end
Expand Down

0 comments on commit 3e9a2df

Please sign in to comment.