44件ヒット
[1-44件を表示]
(0.089秒)
検索結果
-
cgi (6007.0)
-
CGI プログラムの支援ライブラリです。
...CGI プログラムの支援ライブラリです。
CGI プロトコルの詳細については以下の文書を参照してください。
* https://tools.ietf.org/html/draft-coar-cgi-v11-03
* 3875: The Common Gateway Interface (CGI) Version 1.1
* https://www.w3.org/CGI/
=== 使用例
=......ist[][ruby]{
require "cgi"
cgi = CGI.new
values = cgi['field_name'] # <== 'field_name' の配列
# 'field_name' が指定されていなかったら、 ""を返す。
fields = cgi.keys # <== field nameの配列
# フォームに 'field_name' というfield nameがあるときに真
cgi......_key?('field_name')
cgi.include?('field_name')
//}
==== フォームフィールドの値をハッシュとして得る
フォームの値をハッシュとして得るには CGI#params を使います。
//emlist[例][ruby]{
require "cgi"
cgi = CGI.new
params = cgi.params
//}
また CGI#params... -
find (6007.0)
-
ディレクトリ配下のファイルを探索するためのモジュールです。
...ールです。
=== 使い方
require "find"
Find.find('/foo','/bar') {|f| ...}
または
require "find"
include Find
find('/foo','/bar') {|f| ...}
以下は、ruby のアーカイブに含まれるサンプルスクリプト
(https://github.com/ruby/ruby/blob/master/sample/troj......#! /usr/bin/env ruby
require "find"
# 他人が書き込み可能な危険なコマンドを探す
for dir in ENV['PATH'].split(File::PATH_SEPARATOR)
Find.find(dir) do |fpath|
if File.file?(fpath) and (File.stat(fpath).mode & 022) != 0
printf("file %s is writable from o... -
rdoc (31.0)
-
RDoc は Ruby のドキュメント生成を行うためのライブラリです。rdoc という ドキュメント生成のためのコマンドも含んでいます。
...ョンです。 JavaDoc と同様に、ソースを解析し、クラス、モ
ジュール、メソッドの定義を抜き出してきます(include,require もです)。そ
してこれらの内容とその直前に書かれたコメントを併合し、ドキュメントを出
力します(現......ください。
=== 概要
インストールすれば、'rdoc' コマンドでドキュメントが生成できます。
(Windows では 'rdoc.bat' です)
$ rdoc [options] [names...]
"rdoc --help" と打てば、最新のオプションに関する情報が得られます。
$ rdoc
こ......できます。
例えば、Rdoc そのもののドキュメントを生成する場合は、以下のようにタイプ
します。
$ rdoc --main rdoc/rdoc.rb
RDoc が生成するドキュメントのコメント部で使える様々なマークアップの方法
は以下の markup の項に... -
tsort (31.0)
-
tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。
...成分に関するモジュールを提供します。
=== Example
//emlist[][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
{1=>[2, 3], 2=>[3], 3=>[], 4=>[]}.tsort
#=> [3, 2, 1, 4]
{......きます。
//emlist[][ruby]{
require 'tsort'
class Make
def initialize
@dep = {}
@dep.default = []
end
def rule(outputs, inputs=[], &block)
triple = [outputs, inputs, block]
outputs.each {|f| @dep[f] = [triple]}
@dep[triple] = inputs
end
def build(target)
each......ns|
if ns.length != 1
fs = ns.delete_if {|n| Array === n}
raise TSort::Cyclic.new("cyclic dependencies: #{fs.join ', '}")
end
n = ns.first
if Array === n
outputs, inputs, block = n
inputs_time = inputs.map {|f| File.mtime f}.max
begin...