ruby - 第 5 章为什么是 Ruby : What is endertromb? 的辛酸指南

标签 ruby

谁能帮助我了解“endertromb”的使用方式,或者在本指南中我可以从哪里获得它? http://poignant.guide/book/chapter-5.html

为什么有 2 个例子,他试图教授有关实例变量的概念,但他似乎在请求文件 endertromb.rb 并使用它。我错过了什么吗?我怎样/怎样才能得到这个文件,这样我就不会出错。我试过谷歌,但一无所获。 下面是他如何使用它的示例代码:

require 'endertromb'
 class WishMaker
   def initialize
     @energy = rand( 6 )
   end
   def grant( wish )
     if wish.length > 10 or wish.include? ' '
       raise ArgumentError, "Bad wish." 
     end
     if @energy.zero?
       raise Exception, "No energy left." 
     end
     @energy -= 1
     Endertromb::make( wish )
   end
 end

最佳答案

Endertromb 只是在另一个文件中定义的一个类,这就是您需要知道的全部内容。正如 _why 他自己在本指南中所述:

Both the wish maker and the mind reader refer to a class named Endertromb. This class is stored in a file endertromb.rb, which is loaded with the code: require 'endertromb'.

The Endertromb class which contained the mysteries of this planet’s powers.

关于ruby - 第 5 章为什么是 Ruby : What is endertromb? 的辛酸指南,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5785424/

相关文章:

ruby - 在运行时在模块/命名空间中创建一个类

ruby - 在不评估内联 Ruby 脚本的情况下将 Haml 转换为 HTML

ruby-on-rails - 从 rails 3.2.12 更改为 3.2.13 时,是什么导致极度缓慢

Vim 中的 Ruby 代码自动缩进

ruby-on-rails - Ruby 在路由中对 Controller 进行复数化

ruby - Amazon Load Balancer 断开与 TorqueBox 的 Web Socket 连接

ruby - 如何让 Ruby 'puts' 将数据写入文件?

javascript - js.erb 是如何工作的

ruby-on-rails - 如何使用 rails 验证 reCAPTCHA?

mysql - Ruby on Rails where 子句找不到正确的记录