お世話になっております
お教えいただきたいことがあります
centos7.3
ruby2.6.2
上記の環境で勉強しています
[vagrant@localhost sample]$ ls Gemfile Gemfile.lock settings.rb settings.yml vendor webserver.rb [vagrant@localhost sample]$ bundle exec ruby webserver.rb Traceback (most recent call last): 5: from webserver.rb:4:in `<main>' 4: from webserver.rb:5:in `<class:Settings>' 3: from /vagrant/sample/vendor/bundle/ruby/2.6.0/gems/settingslogic-2.0.9/lib/settingslogic.rb:66:in `method_missing' 2: from /vagrant/sample/vendor/bundle/ruby/2.6.0/gems/settingslogic-2.0.9/lib/settingslogic.rb:60:in `instance' 1: from /vagrant/sample/vendor/bundle/ruby/2.6.0/gems/settingslogic-2.0.9/lib/settingslogic.rb:60:in `new' /vagrant/sample/vendor/bundle/ruby/2.6.0/gems/settingslogic-2.0.9/lib/settingslogic.rb:98:in `initialize': No such file or directory - No file specified as Settingslogic source (Errno::ENOENT) [vagrant@localhost sample]$ ruby -v ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-linux]
このようなエラーが出ます
webserver.rb require 'settingslogic' require 'webrick' class Settings < Settingslogic sourse "settings.yml" end server = WEBrick::HTTPServer.new({ :BindAddress => Settings.address, :Port => Settings.port }) trap('INT'){ server.shutdown } server.start
/vagrant/sample/vendor/bundle/ruby/2.6.0/gems/settingslogic-2.0.9/lib/settingslogic.rb:98:in `initialize': No such file or directory - No file specified as Settingslogic source (Errno::ENOENT)
意味がはっきりしません
lib/settingslogic.rb:98:in
def initialize(hash_or_file = self.class.source, section = nil) #puts "new! #{hash_or_file}" case hash_or_file when nil raise Errno::ENOENT, "No file specified as Settingslogic source" when Hash self.replace hash_or_file else file_contents = open(hash_or_file).read hash = file_contents.empty? ? {} : YAML.load(ERB.new(file_contents).result).to_hash if self.class.namespace hash = hash[self.class.namespace] or return missing_key("Missing setting '#{self.class.namespace}' in #{hash_or_file}") end self.replace hash end @section = section || self.class.source # so end of error says "in application.yml" create_accessors! end
申し訳ございませんがご指導ください
ちなみに学習しているのは下記です
http://schoo.jp/class/3857/room

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/06/03 01:08