我正在尝试编写一个简单的程序,该程序采用 rgb 值并使用鞋子(Raisins 修订版 1134)将背景更改为该颜色。这是我的代码:
Shoes.app :title => "Show a Color" do
def convert_to_num(value)
# Splits string into numerical values
value.split(',').map { |num| num.to_i }
end
def to_rgb(value)
red, green, blue = convert_to_num(value)
rgb(red, green, blue)
end
stack :height => 500, :width => 500 do
value = edit_line
button "Change color!" do
background to_rgb(value)
end
end
end
当我运行它时,我得到这个错误:调用私有方法'split'(Shoes::EditLine):Shoes::EditLine。为什么是这样?该方法适用于 irb。