易截截图软件、单文件、免安装、纯绿色、仅160KB

ruby命令行解析

   可用库:getoptlong.rs, optionparser
   对应类:GetoptLong,  OptionParser
   前者已过时,建议使用后者,且后者比前者易用。
后者特点:
1. 参数描述和代码处理写在一起
2. 输出参数说明,不需单独维护
3. 可选参数和命令参数描述简洁
4. 参数可自动转换为特定的类
5. 参数可限制在某个集合中
**************************************************************************
**************API(1.8.6)中的例子: example.rb**********************
  require 'optparse'
  require 'optparse/time'
  require 'ostruct'
  require 'pp'
  class OptparseExample
    CODES = %w[iso-2022-jp shift_jis euc-jp utf8 binary]
    CODE_ALIASES = { "jis" => "iso-2022-jp", "sjis" => "shift_jis" }
    #
    # Return a structure describing the options.
    #
    def self.parse(args)
      # The options specified on the command line will be collected in *options*.     命令行的选项在options结构体中
      # We set default values here.
      options = OpenStruct.new
      options.library = []
      options.inplace = false
      options.encoding = "utf8"
      options.transfer_type = :auto
      options.verbose = false
      opts = OptionParser.new do |opts|
        opts.banner = "Usage: example.rb [options]"
        opts.separator ""
        opts.separator "Specific options:"
        # Mandatory argument.
        opts.on("-r", "


相关文档:

转载——Ruby字符串处理

转自:http://developer.51cto.com/art/200912/170762.htm 
Ruby字符串处理函数总结列表分享
Ruby字符串处理函数包括返回字符串长度函数;判断字符串中是否包含另一个串函数;字符串插入;字符串分隔,默认分隔符为空格等等。
 
str.length => integer 
str.include? other_str
&nbs ......

21本经典ruby rails电子书


Beginning Ruby from Novice To Perfessional

Head First Rails

Agile Web Development with Rails 3rd Edition(new)

Agile Web Development with Rails 3rd Edition

Agile Web Development with Rails 3rd Editio ......

菜鸟和RMXP和Ruby语言

      喜欢玩阿月系列RPG游戏的我,跟不少童鞋一样下了RPGMakerXP来瞻仰一下。当时觉得这个软件太方便了,用鼠标随便点点就能弄出来个有趣的小游戏。因为里面不仅自带不少地图和人物行走图等素材,容易上手的操作方式也让自己大有成就感……可是游戏毕竟是离不开编程,解开游戏包,看 ......

Fix Thrift 0.2.0 Installation with Ruby 1.9.1

When I try the command "gem install thrift" with Ruby 1.9.1, I got a compilation error with something related to a C function "strlcpy()".
Then I searched the web. It seems I am not alone and the community know it.
However I do not want to wait for official update, I want to ......

用ruby写的web抓取小工具

最近由于学习使用linux下的C开发,需要查询Linux C函数参考,就经常上http://man.chinaunix.net/develop/c&c++/linux_c/default.htm查看,描述得比较详细而且还有例子。
网上还有许多各种技术的网页格式的参考材料都非常强大,可惜很多时候都没有网。于是就想写个脚本可以把文档下载,像android开发者文档一样弄到本地 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号