$LOAD_PATH 执行 require 读取文件时搜索的目录名数组,也可以写作 $: 创建 URI 的时候可以直接这样 URI("http://www.dy2018.com/i/97519.html") 看上去像是用一个类名直接接收一个参数来创建的,但是其实在 uri 库中的 common.rb 中有这么一段 module Kernel # # Returns +uri+ converted to a URI object. # def URI(uri) if uri.is_a?(…
print .puts 和 p 方法的区别."" 与 '' 的区别. 处理控制台编码问题 >ruby -E utf-8 脚本文件名称 # 执行脚本 >irb -E utf-8 # 启动 irb 以等号结尾的方法: class Text def text=(x) x*x end end text = Text.new #一下方法调用功能相同 text.text=(6) text.text = 6 条件判断 if then else end 循环语句 while 条件 do…