るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
29件ヒット [1-29件を表示] (0.027秒)
トップページ > クエリ:name[x] > モジュール:Kernel[x] > バージョン:2.6.0[x]

別のキーワード

  1. _builtin name
  2. resolv each_name
  3. openssl name
  4. net/imap name
  5. win32ole name

ライブラリ

キーワード

検索結果

Kernel#namespace(name = nil) { ... } -> Rake::NameSpace (18907.0)

新しい名前空間を作成します。

新しい名前空間を作成します。

与えられたブロックを評価する間は、その名前空間を使用します。

例:
ns = namespace "nested" do
task :run
end
task_run = ns[:run] # find :run in the given namespace.

@see Rake::TaskManager#in_namespace

Kernel#Pathname(path) -> Pathname (18604.0)

文字列 path を元に Pathname オブジェクトを生成します。

文字列 path を元に Pathname オブジェクトを生成します。

Pathname.new(path) と同じです。

@param path 文字列、または類似のオブジェクトを与えます。
実際には to_str に反応するオブジェクトなら何でも構いません。

Kernel$$FILENAME -> String (18304.0)

仮想ファイル Object::ARGF で現在読み込み中のファイル名です。 ARGF.class#filename と同じです。

仮想ファイル Object::ARGF で現在読み込み中のファイル名です。
ARGF.class#filename と同じです。

この変数はグローバルスコープです。

Kernel$$PROGRAM_NAME -> String (9307.0)

現在実行中の Ruby スクリプトの名前を表す文字列です。

現在実行中の Ruby スクリプトの名前を表す文字列です。

OS と Ruby のバージョンによっては、この変数に代入すると ps(1) の出力が変化します。
この機能はプログラムの現在の状態を表示するのに便利です。

この変数はグローバルスコープです。

Kernel.#open(name, mode = 'r', perm = nil, options = {}) -> StringIO | Tempfile | IO (484.0)

name が http:// や ftp:// で始まっている文字列なら URI のリソースを 取得した上で StringIO オブジェクトまたは Tempfile オブジェクトとして返します。 返されるオブジェクトは OpenURI::Meta モジュールで extend されています。

...ock) のように name の open メソッドが呼ばれます。

これ以外の場合は、name はファイル名として扱われ、従来の
Kernel
.#open(name, *rest) が呼ばれます。

ブロックを与えた場合は上の場合と同様、name が http:// や ftp:// で
始まって...
...ram mode モードを文字列で与えます。Kernel.#open と同じです。

@param perm open(2) の第 3 引数のように、ファイルを生成する場合のファイルのパーミッションを
整数で指定します。Kernel.#open と同じです

@param options ハッシ...

絞り込み条件を変える

Kernel.#open(name, mode = 'r', perm = nil, options = {}) {|ouri| ...} -> object (484.0)

name が http:// や ftp:// で始まっている文字列なら URI のリソースを 取得した上で StringIO オブジェクトまたは Tempfile オブジェクトとして返します。 返されるオブジェクトは OpenURI::Meta モジュールで extend されています。

...ock) のように name の open メソッドが呼ばれます。

これ以外の場合は、name はファイル名として扱われ、従来の
Kernel
.#open(name, *rest) が呼ばれます。

ブロックを与えた場合は上の場合と同様、name が http:// や ftp:// で
始まって...
...ram mode モードを文字列で与えます。Kernel.#open と同じです。

@param perm open(2) の第 3 引数のように、ファイルを生成する場合のファイルのパーミッションを
整数で指定します。Kernel.#open と同じです

@param options ハッシ...

Kernel.#autoload(const_name, feature) -> nil (427.0)

定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。

...定数 const_name を最初に参照した時に feature を
Kernel
.#require するように設定します。

const_name には、 "::" 演算子を含めることはできません。
ネストした定数を指定する方法は Module#autoload を参照してください。

const_name が aut...
...対象を指定します。
@raise LoadError featureのロードに失敗すると発生します。

//emlist[][ruby]{
# ------- /tmp/foo.rb ---------
class Bar
end
# ----- end of /tmp/foo.rb ----

autoload :Bar, '/tmp/foo'
p Bar #=> Bar
//}

@see Kernel.#autoload?,Module#autoload,Kernel.#require...

Kernel#Digest(name) -> object (373.0)

"MD5"や"SHA1"などのダイジェストを示す文字列 name を指定し、 対応するダイジェストのクラスを取得します。

...
Digest::MD5などを直接呼び出すと問題があるときはこのメソッドを使
うか、起動時に使用するライブラリを Kernel.#require してください。

@param name "MD5"や"SHA1"などのダイジェストを示す文字列を指定します。
@return Digest::MD5や...

Kernel.#autoload?(const_name) -> String | nil (373.0)

const_name が Kernel.#autoload 設定されているか調べます。

...const_name が Kernel.#autoload 設定されているか調べます。

autoload 設定されていて、autoload 定数がまだ定義されてない(ロードされていない)
ときにそのパス名を返します。

autoload 設定されていないか、ロード済みなら nil を返し...
...lass Foo
class Bar
end
end
# ----- end of /tmp/foo.rb ----

class Foo
end
p Foo.autoload?(:Bar) #=> nil
Foo.autoload :Bar, '/tmp/foo'
p Foo.autoload?(:Bar) #=> "/tmp/foo"
p Foo::Bar #=> Foo::Bar
p Foo.autoload?(:Bar) #=> nil
//}

@see Kernel.#autoload...

Kernel#gem(gem_name, *version_requirements) -> bool (307.0)

$LOAD_PATH に Ruby Gem を追加します。

$LOAD_PATH に Ruby Gem を追加します。

指定された Gem をロードする前にその Gem が必要とする Gem をロードします。
バージョン情報を省略した場合は、最も高いバージョンの Gem をロードします。
指定された Gem やその Gem が必要とする Gem が見つからなかった場合は
Gem::LoadError が発生します。

バージョンの指定方法に関しては Gem::Version を参照してください。

rubygems ライブラリがライブラリバージョンの衝突を検出しない限り、
gem メソッドは全ての require メソッドよりも前に実行されます。

...

絞り込み条件を変える

Kernel#import(*filenames) (304.0)

分割された Rakefile をインポートします。

分割された Rakefile をインポートします。

インポートされたファイルは、現在のファイルが完全にロードされた後でロードされます。
このメソッドはインポートするファイルのどこで呼び出されてもかまいません。
また、インポートされるファイル内に現れるオブジェクトはインポートするファイル内で定義
されているオブジェクトに依存していてもかまいません。

このメソッドは依存関係を定義したファイルを読み込むのによく使われます。

@param filenames インポートする Rakefile を指定します。

例:
import ".depend", "my_rules"

Kernel.#eval(expr, bind, fname = "(eval)", lineno = 1) -> object (304.0)

文字列 expr を Ruby プログラムとして評価してその結果を返しま す。第2引数に Binding オブジェクトを与えた場合、 そのオブジェクトを生成したコンテキストで文字列を評価します。

...val('a = RUBY_RELEASE_DATE')
p a #=> "2007-03-13"

eval('def fuga;p 777 end')
fuga #=> 777

eval('raise RuntimeError', binding, 'XXX.rb', 4)
#=> XXX.rb:4: RuntimeError (RuntimeError)
# from ..:9
//}

@see Kernel.#binding,Module#module_eval,BasicObject#instance_eval,Object#method,Object#send...

Kernel.#trace_var(varname) {|new_val| .... } -> nil (304.0)

グローバル変数 varname への代入のフックを登録します。

...は明示的な代入だけです。
フックは複数登録できます。

フックを解除するには、hook に nil を
指定するか、Kernel.#untrace_var を用います。

hook が nil ならば、設定されていた
hook をすべて解除してその配列を返します(ブロッ...
...ます。解除した場合は解除した
フックを並べた配列を返します。

//emlist[例][ruby]{
trace_var(:$v){|val| puts "hook: $v=#{val.inspect}" }
$v = 1 #=> hook: $v=1
$v = "foo" #=> hook: $v="foo"
$v.upcase!
p $v #=> "FOO"
//}

@see Kernel.#untrace_var...

Kernel.#trace_var(varname, hook) -> [String|Proc] (304.0)

グローバル変数 varname への代入のフックを登録します。

...は明示的な代入だけです。
フックは複数登録できます。

フックを解除するには、hook に nil を
指定するか、Kernel.#untrace_var を用います。

hook が nil ならば、設定されていた
hook をすべて解除してその配列を返します(ブロッ...
...ます。解除した場合は解除した
フックを並べた配列を返します。

//emlist[例][ruby]{
trace_var(:$v){|val| puts "hook: $v=#{val.inspect}" }
$v = 1 #=> hook: $v=1
$v = "foo" #=> hook: $v="foo"
$v.upcase!
p $v #=> "FOO"
//}

@see Kernel.#untrace_var...

Kernel.#trace_var(varname, hook) -> nil (304.0)

グローバル変数 varname への代入のフックを登録します。

...は明示的な代入だけです。
フックは複数登録できます。

フックを解除するには、hook に nil を
指定するか、Kernel.#untrace_var を用います。

hook が nil ならば、設定されていた
hook をすべて解除してその配列を返します(ブロッ...
...ます。解除した場合は解除した
フックを並べた配列を返します。

//emlist[例][ruby]{
trace_var(:$v){|val| puts "hook: $v=#{val.inspect}" }
$v = 1 #=> hook: $v=1
$v = "foo" #=> hook: $v="foo"
$v.upcase!
p $v #=> "FOO"
//}

@see Kernel.#untrace_var...

絞り込み条件を変える

Kernel.#untrace_var(varname, hook = nil) -> [String|Proc] (304.0)

グローバル変数 varname に関連付けられたフックを解除します。

...#=> hookB."str",hookA."str",

untrace_var(:$v,block)
$v = 'str' #=> hookA."str",

trace_var(:$v){|val| print "hookC.#{val.inspect}," }
p untrace_var(:$v) #=> [#<Proc:0x02b68f58@..:9>, #<Proc:0x02b6978c@..:3>]
$v = 'str' # なにも出力されない
//}

@see Kernel.#trace_var...

Kernel#convertible_int(type, headers = nil, opts = nil) (244.0)

Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG

Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.

If the +type+ is a integer type and _convertible_ type is found,
following macros are p...

Kernel#convertible_int(type, headers = nil, opts = nil) { ... } (244.0)

Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG

Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.

If the +type+ is a integer type and _convertible_ type is found,
following macros are p...

Kernel#check_signedness(type, headers = nil, opts = nil) -> "signed" | "unsigned" | nil (100.0)

Returns the signedness of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. If the +type+ is found and is a numeric type, a macro is passed as a preprocessor constant to the compiler using the +type+ name, in uppercase, prepended with 'SIGNEDNESS_OF_', followed by the +type+ name, followed by '=X' where 'X' is positive integer if the +type+ is unsigned, or negative integer if the +type+ is signed. For example, if size_t is defined as unsigned, then check_signedness('size_t') would returned +1 and the SIGNEDNESS_OF_SIZE_T=+1 preprocessor macro would be passed to the compiler, and SIGNEDNESS_OF_INT=-1 if check_signedness('int') is done.

Returns the signedness of the given +type+. You may optionally
specify additional +headers+ to search in for the +type+.

If the +type+ is found and is a numeric type, a macro is passed as a
preprocessor constant to the compiler using the +type+ name, in
uppercase, prepended with 'SIGNEDNESS...

Kernel#check_signedness(type, headers = nil, opts = nil) { ... } -> "signed" | "unsigned" | nil (100.0)

Returns the signedness of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. If the +type+ is found and is a numeric type, a macro is passed as a preprocessor constant to the compiler using the +type+ name, in uppercase, prepended with 'SIGNEDNESS_OF_', followed by the +type+ name, followed by '=X' where 'X' is positive integer if the +type+ is unsigned, or negative integer if the +type+ is signed. For example, if size_t is defined as unsigned, then check_signedness('size_t') would returned +1 and the SIGNEDNESS_OF_SIZE_T=+1 preprocessor macro would be passed to the compiler, and SIGNEDNESS_OF_INT=-1 if check_signedness('int') is done.

Returns the signedness of the given +type+. You may optionally
specify additional +headers+ to search in for the +type+.

If the +type+ is found and is a numeric type, a macro is passed as a
preprocessor constant to the compiler using the +type+ name, in
uppercase, prepended with 'SIGNEDNESS...

絞り込み条件を変える

Kernel.#format(format, *arg) -> String (94.0)

format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。

...トした文字列を返します。

@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime

=== sprintf フォーマット

Ruby の sprintf フォーマットは基本的に C 言語の sprintf(3)...
...tf("%p", /e+/) #=> "/e+/"
//}


: d
: i

引数の数値を10進表現の整数として出力します。

引数が整数でなければ関数 Kernel.#Integer と同じ規則で整数に
変換されます。

//emlist[][ruby]{
p sprintf("%d", -1) #=> "-1"
p sprintf("%d", 3.1) #=> "3"
p sprint...

Kernel.#sprintf(format, *arg) -> String (94.0)

format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。

...トした文字列を返します。

@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime

=== sprintf フォーマット

Ruby の sprintf フォーマットは基本的に C 言語の sprintf(3)...
...tf("%p", /e+/) #=> "/e+/"
//}


: d
: i

引数の数値を10進表現の整数として出力します。

引数が整数でなければ関数 Kernel.#Integer と同じ規則で整数に
変換されます。

//emlist[][ruby]{
p sprintf("%d", -1) #=> "-1"
p sprintf("%d", 3.1) #=> "3"
p sprint...

Kernel#JSON(object, options = {}) -> object (76.0)

第一引数に与えられたオブジェクトの種類によって Ruby のオブジェクトか JSON 形式の文字列を返します。

第一引数に与えられたオブジェクトの種類によって Ruby のオブジェクトか JSON 形式の文字列を返します。

第一引数に文字列のようなオブジェクトを指定した場合は、それを JSON.#parse を用いてパースした結果を返します。
そうでないオブジェクトを指定した場合は、それを JSON.#generate を用いて変換した結果を返します。

@param object 任意のオブジェクトを指定します。

@param options JSON.#parse, JSON.#generate に渡すオプションを指定します。

//emlist[例][ruby]{
require "json...

Kernel#httpd -> () (58.0)

WEBrick HTTP server を起動します。

WEBrick HTTP server を起動します。

ruby -run -e httpd -- [OPTION] [DocumentRoot]

--bind-address=ADDR バインドアドレスを指定します
--port=NUM ポート番号を指定します
--max-clients=MAX 同時接続数の最大値
--temp-dir=DIR 一時ディレクトリを指定します
--do-not-reverse-lookup 逆引きを無効にします
--requ...

Kernel#j(*objects) -> nil (40.0)

与えられたオブジェクトを JSON 形式の文字列で標準出力に一行で出力します。

...トを JSON 形式の文字列で標準出力に一行で出力します。

@param objects JSON 形式で出力したいオブジェクトを指定します。

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

j([1,2,{"name" => "tanaka","age" => 19}])
# => [1,2,{"name":"tanaka","age":19}]
//}

@see Kernel.#p...

絞り込み条件を変える

Kernel#jj(*objects) -> nil (40.0)

与えられたオブジェクトを JSON 形式の文字列で標準出力に人間に読みやすく整形して出力します。

...します。

@param objects JSON 形式で出力したいオブジェクトを指定します。

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

jj([1,2,{"name" => "tanaka","age" => 19}])
# => [
# 1,
# 2,
# {
# "name": "tanaka",
# "age": 19
# }
# ]
//}

@see Kernel.#pp...

Kernel#ln -> () (40.0)

ファイルへのリンクを作成します。

ファイルへのリンクを作成します。

ruby -run -e ln -- [OPTION] TARGET LINK_NAME

-s ハードリンクの代わりにシンボリックリンクを作成します
-f LINK_NAME を上書きします
-v 詳細表示

@see ln(1)

Kernel#rule(*args) {|t| ... } -> Rake::Task (22.0)

自動的に作成するタスクのためのルールを定義します。

自動的に作成するタスクのためのルールを定義します。

@param args ルールに与えるパラメータを指定します。

例:
rule '.o' => '.c' do |t|
sh %{cc -o #{t.name} #{t.source}}
end

Kernel$$0 -> String (7.0)

現在実行中の Ruby スクリプトの名前を表す文字列です。

現在実行中の Ruby スクリプトの名前を表す文字列です。

OS と Ruby のバージョンによっては、この変数に代入すると ps(1) の出力が変化します。
この機能はプログラムの現在の状態を表示するのに便利です。

この変数はグローバルスコープです。