Skip to content

Commit 114165b

Browse files
committed
method overloading in setup hash or file
1 parent fcf6a63 commit 114165b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/rubycas-server-core/settings.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ module Settings
1111
@_settings = HashWithIndifferentAccess.new
1212
attr_reader :_settings
1313

14-
def load!(file_name)
15-
config = YAML::load_file(file_name).with_indifferent_access
16-
@_settings.merge!(config)
14+
def load!(config)
15+
if config.is_a? String
16+
config = YAML::load_file(config).with_indifferent_access
17+
elsif config.is_a? Hash
18+
@_settings.merge!(config)
19+
end
1720
end
1821

1922
def method_missing(name, *args, &block)

0 commit comments

Comments
 (0)