您的当前位置:TAGS -> Ruby
  • Ruby入门常见问题

    后端开发2025年07月23日

    1,(irb):class/module name must be CONSTANT class Cats (类名首字母要大写) ...

  • 如何在Mac OS X上安装 Ruby运行环境

    后端开发2025年07月23日

    对于新入门的开发者,如何安装 Ruby和Ruby Gems 的运行环境可能会是个问题,本页主要介绍如何用一条靠谱的路子快速安装 Ruby 开发环境。此安装方法同样适用于产品环境! 系统需求 首先确定操作系统环境,不建议在 Windows 上面搞,所以你需要用: Mac OS X 任意 Linux 发行版本(Ubuntu,CentOS, Redhat, Ar...

  • ruby实现删除自定义后缀名文件Find

    后端开发2025年07月23日

    #encoding: gbk require 'find' print "输入目录:" path=gets.chomp! print "输入后缀名:" basename=gets.chomp! Find.find("#{path}") do |d| if d.include?(".torrent") puts "[INFO]删除文件#{d}" end en...

  • ruby实现按键精灵的功能

    后端开发2025年07月23日

    先说下利用了AutoItX3.dll这个API,这个东西没有怎么办,ruby的watir GEM包里自带这个dll。 如果出现 “unknown OLE server: ‘AutoItX3.Control’(WIN32OLERuntimeError) ”这个错误,可能是因为你的dll没有注册。 解决方式如下: regsvr32 AutoItX3.dll 路...

  • Ruby中实现module继承

    后端开发2025年07月23日

    module FooModule def self.included base base.extend ClassMethods end module ClassMethods def bar puts "module" end endendmodule Klass include FooModule def self.bar puts...

  • Ruby 中关键字涵义

    后端开发2025年07月22日

    1 、 break 跳出当层循环 2 、next 忽略本次循环的的剩余部分,开始下一次循环 3 、redo 重新开始循环,还是从这一次开始 4 、retry 重头开始这个循环体 5 、$array<< value 将 value 作为数组的一个元素加入数组 $array 中 6 、attr_writer :username 相当...

  • Ruby 标识名和变量作用域

    后端开发2025年07月22日

    Ruby 的标识名用来指向常量,变量,方法,类和模块。标识名的首字母用来帮助我们确定标识所指向内容的作用域。 Ruby 的标识名区分大小写。 Ruby 使用一个约定的来帮助它区别一个名字的用法: a). 名字前面的第一个字符表明这个名字的用法。 b). 局部变量、方法参数和方法名称应该用一个小写字母开头或者用一个下划线开头。 c). 全局变量用美元符作为前...

  • Ruby 中模块

    后端开发2025年07月22日

    使用模块中常量 :模块名::常量名 定义模块用module...end 。模块与类非常相似,但是: A) 模块不可以有实例对象; B) 模块不可以有子类。 ...

  • [导入]Thumbnailer in Ruby and RMagick

    后端开发2025年07月22日

    require 'RMagick' maxwidth = 120 maxheight = 160 aspectratio = maxwidth.to_f / maxheight.to_f imgfile = 'world' pic = Magick::Image.read(imgfile + '.jpg').first imgwidth = pic.col...

  • [导入]Produce GIF or PNG barcode images from a Ruby on Rails application using RMagick and Gbarcode

    后端开发2025年07月22日

    This is a Ruby on Rails controller that produces PNG barcode images using RMagick (http://rmagick.rubyforge.org/) and Gbarcode (http://gbarcode.rubyforge.org/), the Ruby Gnu Barco...