るりまサーチ

最速Rubyリファレンスマニュアル検索!
96件ヒット [1-96件を表示] (0.087秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

キーワード

検索結果

String#sum(bits = 16) -> Integer (18192.0)

文字列の bits ビットのチェックサムを計算します。

...[ruby]{
def sum(bits)
sum
= 0
each_byte {|c| sum += c }
return 0 if sum == 0
sum
& ((1 << bits) - 1)
end

//}

例えば以下のコードで UNIX System V の
sum
(1) コマンドと同じ値が得られます。

//emlist[例][ruby]{
sum
= 0
ARGF.each_line do |line|
sum
+= line.sum
end

sum
...
...%= 65536
//}

@
param bits チェックサムのビット数...

OptionParser#summarize(to = [], width = self.summary_width, max = width - 1, indent= self.summary_indent) -> () (6337.0)

サマリを指定された to へと加えていきます。

...ません。

@
param to サマリを出力するオブジェクトを指定します。to には << メソッドが定義されいる必要があります。

@
param width サマリの幅を整数で指定します。

@
param max サマリの最大幅を整数で指定します。

@
param indent サ...
...ます。

//emlist[例][ruby]{
require "optparse"

opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end


opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summarize(["description\n"], 10...

OptionParser#summarize(to = [], width = self.summary_width, max = width - 1, indent= self.summary_indent) {|line| ... } -> () (6337.0)

サマリを指定された to へと加えていきます。

...ません。

@
param to サマリを出力するオブジェクトを指定します。to には << メソッドが定義されいる必要があります。

@
param width サマリの幅を整数で指定します。

@
param max サマリの最大幅を整数で指定します。

@
param indent サ...
...ます。

//emlist[例][ruby]{
require "optparse"

opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end


opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summarize(["description\n"], 10...

Fiber#resume(*arg = nil) -> object (6131.0)

自身が表すファイバーへコンテキストを切り替えます。 自身は resume を呼んだファイバーの子となります。

...ます。
自身は resume を呼んだファイバーの子となります。

ただし、Fiber#transfer を呼び出した後に resume を呼び出す事はでき
ません。

@
param arg self が表すファイバーに渡したいオブジェクトを指定します。

@
return コンテキス...
...ブロックの評価結果
を返します。

@
raise FiberError 自身が既に終了している場合、コンテキストの切替が
Thread クラスが表すスレッド間をまたがる場合、自身が resume を
呼んだファイバーの親...
...また、Fiber#transfer を呼び出した後に resume を
呼び出した場合に発生します。

//emlist[例:][ruby]{

f = Fiber.new do
Fiber.yield(:hoge)
:fuga
end


p f.resume() #=> :hoge
p f.resume() #=> :fuga
p f.resume() #=> FiberError: dead fiber called
//}...

OptionParser#summary_indent -> String (6119.0)

サマリを表示する時のインデントを文字列で返します。

...で返します。

@
return サマリを表示する時のインデントを文字列で返します。

//emlist[例][ruby]{
require "optparse"

opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end


opts.summary_indent...
...# => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summary_indent = " "
opts.summary_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
//}...

絞り込み条件を変える

OptionParser#summary_indent=(indent) (6119.0)

サマリを表示する時のインデントを文字列で指定します。

...す。

@
param indent サマリを表示する時に使われるインデントを文字列で指定します。

//emlist[例][ruby]{
require "optparse"

opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end


opts.summary_ind...
...ent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summary_indent = " " # => " "
opts.summary_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
//}...

OptionParser#summary_width -> Integer (6119.0)

サマリを表示するときの幅を整数で返します。

...す。

@
return サマリを表示するときの幅を整数で返します。

//emlist[例][ruby]{
require "optparse"

opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end


opts.summary_width # => 32
opts.summarize
# =...
...> [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summary_width = 8
opts.summary_width # =>8
opts.summarize
# => [" -i\n", " --init\n", " -u\n", " --update\n", " -h\n", " --help\n"]
//}...

OptionParser#summary_width=(width) (6119.0)

サマリを表示するときの幅を整数で指定します。

...

@
param width サマリを表示するときの幅を整数で指定します。

//emlist[例][ruby]{
require "optparse"

opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end


opts.summary_width # => 32
opts.summariz...
...e
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summary_width = 8 # => 8
opts.summary_width # => 8
opts.summarize
# => [" -i\n", " --init\n", " -u\n", " --update\n", " -h\n", " --help\n"]
//}...