Skip to content

Commit 4884d45

Browse files
committed
Merge pull request #32 from maxwell/open_uri
Allow settingslogic to open a remote yml file
2 parents 70a1fe4 + 7fd064a commit 4884d45

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/settingslogic.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require "yaml"
22
require "erb"
3+
require 'open-uri'
34

45
# A simple settings solution using a YAML file. See README for more information.
56
class Settingslogic < Hash
@@ -110,7 +111,7 @@ def initialize(hash_or_file = self.class.source, section = nil)
110111
when Hash
111112
self.replace hash_or_file
112113
else
113-
hash = YAML.load(ERB.new(File.read(hash_or_file)).result).to_hash
114+
hash = YAML.load(ERB.new(open(hash_or_file).read).result).to_hash
114115
if self.class.namespace
115116
hash = hash[self.class.namespace] or return missing_key("Missing setting '#{self.class.namespace}' in #{hash_or_file}")
116117
end

0 commit comments

Comments
 (0)