るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

String#sum(bits = 16) -> Integer (18198.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
...

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

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

...ます。

//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| ... } -> () (6319.0)

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

...ます。

//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 (6119.0)

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

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

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

@param arg self が表すファイバーに渡した...
...、自身が 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)

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

...t[例][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_i...
...ndent = " "
opts.summary_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
//}...

絞り込み条件を変える

OptionParser#summary_indent=(indent) (6119.0)

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

...t[例][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_i...
...ndent = " " # => " "
opts.summary_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
//}...

OptionParser#summary_width -> Integer (6119.0)

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

...mlist[例][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)

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

...mlist[例][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 # => 8
opts.summary_width # => 8
opts.summarize
# => [" -i\n", " --init\n", " -u\n", " --update\n", " -h\n", " --help\n"]
//}...