るりまサーチ

最速Rubyリファレンスマニュアル検索!
22件ヒット [1-22件を表示] (0.571秒)
トップページ > クエリ:Hash#key[x] > クエリ:new[x] > クエリ:keep_if[x] > クエリ:fetch_values[x] > クエリ:key?[x] > クエリ:delete[x] > クエリ:index[x] > クエリ:reject[x] > 種類:ライブラリ[x]

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

キーワード

検索結果

cgi (37.0)

CGI プログラムの支援ライブラリです。

...gi"
cgi = CGI.new
values = cgi['field_name'] # <== 'field_name' の配列
# 'field_name' が指定されていなかったら、 ""を返す。
fields = cgi.keys # <== field nameの配列

# フォームに 'field_name' というfield nameがあるときに真
cgi.has_key?('field_name')...
...gi = CGI.new
params = cgi.params
//}

また CGI#params は毎回同じ Hash オブジェクトを返すので
以下のような使いかたもできます。

//emlist[][ruby]{
cgi.params['new_field_name'] = ["value"] # 新しいパラメータを加える
cgi.params['field_name'] = ["new_value"]...
...# パラメータの値を変える
cgi.params.delete('field_name') # パラメータを消去
cgi.params.clear # 全パラメータを消去
//}

==== フォームフィールドの値をファイルに保存する

PStore を使うのが最も簡単です。

/...

tsort (13.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,...
...nd

def build(target)
each_strongly_connected_component_from(target) {|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, bloc...
...tsort_each_child(node, &block)
@dep[node].each(&block)
end
include TSort
end

def command(arg)
print arg, "\n"
system arg
end

m = Make.new
m.rule(%w[t1]) { command 'date > t1' }
m.rule(%w[t2]) { command 'date > t2' }
m.rule(%w[t3]) { command 'date > t3' }
m.rule(%w[t4], %w[t1 t3]) { co...