尝试创建基于bundler's official guide on developing a Ruby gem的宝石。 运行bundle gem foodie将在lib目录中创建一个结构和生成文件: 美食家 version.rb foodie.rb 美食家。 rb读取 require "foodie/version"
module Foodie
# Your code goes he
为什么下面的代码给出了下面的错误? require 'open3'
module Hosts
def read
include Open3
popen3("cat /etc/hosts") do |i,o,e,w|
puts o.read
end
end
end
Hosts.read
#=> undefined method