scinote-web/app/models/settings.rb

20 lines
405 B
Ruby
Raw Normal View History

2019-05-09 23:10:02 +08:00
# frozen_string_literal: true
2017-06-23 21:19:08 +08:00
class Settings < ApplicationRecord
def self.instance
first || new
end
def values
merged_values = super
self.class.instance_methods(false).grep(/^load_values_from_[A-Z0-9_]*/).each do |method|
merged_values = merged_values.merge(public_send(method))
end
merged_values
end
def load_values_from_env
raise NotImplementedError
end
end