るりまサーチ

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

別のキーワード

  1. rake empty_task_args
  2. optparse args
  3. closure args
  4. fiddle args
  5. parseerror args

クラス

モジュール

検索結果

<< 1 2 3 ... > >>

FileUtils#ruby(*args) {|result, status| ... } (18236.0)

与えられた引数で Ruby インタプリタを実行します。

...与えられた引数で Ruby インタプリタを実行します。

@param args Ruby インタプリタに与える引数を指定します。

例:
ruby
%{-pe '$_.upcase!' <README}

@see Kernel.#sh...

Hash.ruby2_keywords_hash?(hash) -> bool (6203.0)

Module#ruby2_keywordsやProc#ruby2_keywordsによる ruby2_keywords フラグが設定されているかどうかを返します。

...Module#ruby2_keywordsやProc#ruby2_keywordsによる
ruby
2_keywords フラグが設定されているかどうかを返します。

このメソッドはデバッグや調査、シリアライゼーションのために本当に必要な場合のために
用意されていて、普通のプログ...
...れていません。

ruby
2.7.1 で追加されたため、ruby 2.7.0 では定義されていません。

//emlist[][ruby]{
ruby
2_keywords def foo(*args)
Hash.ruby2_keywords_hash?(args.last)
end
foo(k: 1) # => true
foo({k: 1}) # => false
//}

@see Module#ruby2_keywords, Proc#ruby2_keywords...

Module#ruby2_keywords(method_name, ...) -> nil (6159.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

...ames, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword arguments, the final hash argum...
...ate keywords to another
method, and only for backwards compatibility with Ruby versions before
2.7.

This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before 2.7, check that the module responds to this method befo...
...aware that if this method is removed, the behavior of the
method will change so that it does not pass through keywords.

//emlist[例][ruby]{
module Mod
def foo(meth, *args, &block)
send(:"do_#{meth}", *args, &block)
end
ruby
2_keywords(:foo) if respond_to?(:ruby2_keywords, true)
end
//}...

Proc#ruby2_keywords -> proc (6159.0)

Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.

...Marks the proc as passing keywords through a normal argument splat. This
should only be called on procs that accept an argument splat (`*args`)
but not explicit keywords or a keyword splat. It marks the proc such
that if the proc is called with keyword arguments, the final hash
argument is marked...
...ate keywords to another
method, and only for backwards compatibility with Ruby versions before
2.7.

This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before 2.7, check that the proc responds to this method before...
...so, be aware that if this method is removed, the behavior of the
proc will change so that it does not pass through keywords.

//emlist[][ruby]{
module Mod
foo = ->(meth, *args, &block) do
send(:"do_#{meth}", *args, &block)
end
foo.ruby2_keywords if foo.respond_to?(:ruby2_keywords)
end
//}...

int rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...) (6142.0)

長さ argc の配列 argv を fmt に従って 解析し、第四引数以降で渡されたアドレスに書き込みます。

...引数の数 (省略可能な引数があるなら省略不可)
* 省略可能な引数の数 (ゼロ個ならば省略可)
* 残りの引数を Ruby の配列として受け取ることを示す '*' (省略可)
* 最後の引数をオプションハッシュとして受け取る事を示す '...
...a, b, optv;
rb_scan_args(argc, argv, "21", &a, &b, &optv);

対応する Ruby プログラムでの宣言

def some_method(a, b, opt = nil)

使用例 (2)

VALUE a, rest, block;
rb_scan_args(argc, argv, "1*&", &a, &rest, &block);

対応する Ruby プログラムでの宣...
...

def some_method(a, *rest, &block)

@see https://github.com/ruby/ruby/blob/master/doc/extension.ja.rdoc...

絞り込み条件を変える

rubygems/commands/pristine_command (6012.0)

インストールされている Gem パッケージを初期状態にするためのライブラリです。

...インストールされている Gem パッケージを初期状態にするためのライブラリです。

Usage: gem pristine [args] [options]
Options:
--all インストールされている全ての Gem パッケージを...
...た設定ファイルを使用します
--backtrace バックトレースを表示します
--debug Ruby 自体のデバッグオプションを有効にします
Arguments:
GEMNAME gem to restore to pristine condition (unless...

rubygems/commands/rdoc_command (6012.0)

RDoc と ri のライブラリを生成するためのライブラリです。

...RDoc と ri のライブラリを生成するためのライブラリです。

Usage: gem rdoc [args] [options]
Options:
--all インストールされている全ての Gem パッケージの
RDoc/RI ドキュメント...
...た設定ファイルを使用します
--backtrace バックトレースを表示します
--debug Ruby 自体のデバッグオプションを有効にします
Arguments:
GEMNAME ドキュメントを生成する Gem パッ...

ruby 1.9 feature (3853.0)

ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。

...ruby 1.9 feature
ruby
version 1.9.0 は開発版です。
以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。
1.9.1 以降は安定版です。
バグ修正がメインになります。

記号について(特に重要なもの...
...は大文字(主観))

* カテゴリ
* [ruby]: ruby インタプリタの変更
* [api]: 拡張ライブラリ API
* [lib]: ライブラリ
* [parser]: 文法の変更
* [regexp]: 正規表現の機能拡張
* [marshal]: Marshal ファイルのフォーマット変更
* レベル
* [b...
....nitems{|i| i % 2 != 0} #=> 2

((<ruby-talk:134083>))

=== 2005-06-02
: proc [ruby][parser][experimental]

以前のローカル変数に括弧を付けると call が呼び出される変更は取り消されて、
(({(expr)(args...)})) で (({expr.call(args...)})) が呼ばれるようにな...

NEWS for Ruby 2.7.0 (3489.0)

NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...NEWS for Ruby 2.7.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス...
...ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。

== 2.6.0 以降の変更

=== 言語仕様の変更

==== パターンマッチ

* パターンマッチが実験的機能として導入されました。 14912

//emlist[][ruby]{
case [0, [1, 2, 3]]
in [a, [b...
...れました。
キーワード引数分離の警告を避けて、Ruby 3での正しい振る舞いを確実にするため、
これらの関数に切り替える必要があるかもしれません。

* rb_scan_argsの書式文字列の「:」はキーワード引数として扱われ...

RubyVM::AbstractSyntaxTree.parse(string) -> RubyVM::AbstractSyntaxTree::Node (3130.0)

文字列を抽象構文木にパースし、その木の根ノードを返します。

...文字列を抽象構文木にパースし、その木の根ノードを返します。

@param string パースする対象の Ruby のコードを文字列で指定します。
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコ...
...リーを生成します。
@raise SyntaxError string が Ruby のコードとして正しくない場合に発生します。

//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
# => (SCOPE@1:0-1:9
# tbl: [:x]
# args: nil
# body:
# (LASGN@1:0-1:9 :x
# (OPC...
...ALL@1:4-1:9 (LIT@1:4-1:5 1) :+ (LIST@1:8-1:9 (LIT@1:8-1:9 2) nil))))
pp RubyVM::AbstractSyntaxTree.parse("x = 1; p(x; y=2", error_tolerant: true)
# => (SCOPE@1:0-1:15
# tbl: [:x, :y]
# args: nil
# body: (BLOCK@1:0-1:15 (LASGN@1:0-1:5 :x (LIT@1:4-1:5 1)) (ERROR@1:7-1:11) (LASGN@1:12-1...

絞り込み条件を変える

RubyVM::AbstractSyntaxTree.parse(string, keep_script_lines: false, error_tolerant: false, keep_tokens: false) -> RubyVM::AbstractSyntaxTree::Node (3130.0)

文字列を抽象構文木にパースし、その木の根ノードを返します。

...文字列を抽象構文木にパースし、その木の根ノードを返します。

@param string パースする対象の Ruby のコードを文字列で指定します。
@param keep_script_lines true を指定すると、 Node#script_lines でノードと関連づけられたソースコ...
...リーを生成します。
@raise SyntaxError string が Ruby のコードとして正しくない場合に発生します。

//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
# => (SCOPE@1:0-1:9
# tbl: [:x]
# args: nil
# body:
# (LASGN@1:0-1:9 :x
# (OPC...
...ALL@1:4-1:9 (LIT@1:4-1:5 1) :+ (LIST@1:8-1:9 (LIT@1:8-1:9 2) nil))))
pp RubyVM::AbstractSyntaxTree.parse("x = 1; p(x; y=2", error_tolerant: true)
# => (SCOPE@1:0-1:15
# tbl: [:x, :y]
# args: nil
# body: (BLOCK@1:0-1:15 (LASGN@1:0-1:5 :x (LIT@1:4-1:5 1)) (ERROR@1:7-1:11) (LASGN@1:12-1...

RubyVM::AbstractSyntaxTree.of(proc) -> RubyVM::AbstractSyntaxTree::Node (3124.0)

引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。

...す。

//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
# => (SCOPE@2:38-2:45
# tbl: []
# args: nil
# body:
# (OPCALL@2:39-2:44 (LIT@2:39-2:40 1) :+
# (LIST@2:43-2:44 (LIT@2:43-2:44 2) nil)))

def hello
puts "hello, world"
end

pp RubyVM::AbstractSyntaxT...
...ree.of(method(:hello))
# => (SCOPE@5:0-7:3
# tbl: []
# args:
# (ARGS@5:9-5:9
# pre_num: 0
# pre_init: nil
# opt: nil
# first_post: nil
# post_num: 0
# post_init: nil
# rest: nil
# kw: nil
# kwrest: nil
# block: nil)...

RubyVM::AbstractSyntaxTree.of(proc, keep_script_lines: false, error_tolerant: false, keep_tokens: false) -> RubyVM::AbstractSyntaxTree::Node (3124.0)

引数 proc に渡したProcやメソッドオブジェクトの抽象構文木を返します。

...す。

//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.of(proc {1 + 2})
# => (SCOPE@2:38-2:45
# tbl: []
# args: nil
# body:
# (OPCALL@2:39-2:44 (LIT@2:39-2:40 1) :+
# (LIST@2:43-2:44 (LIT@2:43-2:44 2) nil)))

def hello
puts "hello, world"
end

pp RubyVM::AbstractSyntaxT...
...ree.of(method(:hello))
# => (SCOPE@5:0-7:3
# tbl: []
# args:
# (ARGS@5:9-5:9
# pre_num: 0
# pre_init: nil
# opt: nil
# first_post: nil
# post_num: 0
# post_init: nil
# rest: nil
# kw: nil
# kwrest: nil
# block: nil)...

RubyVM::AbstractSyntaxTree.parse(string) -> RubyVM::AbstractSyntaxTree::Node (3124.0)

文字列を抽象構文木にパースし、その木の根ノードを返します。

...スする対象の Ruby のコードを文字列で指定します。
@raise SyntaxError string が Ruby のコードとして正しくない場合に発生します。

//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
# => (SCOPE@1:0-1:9
# tbl: [:x]
# args: nil
# body:...

RubyVM::AbstractSyntaxTree.parse_file(pathname) -> RubyVM::AbstractSyntaxTree::Node (3118.0)

pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。

...ise SyntaxError pathname から取得された文字列が Ruby のコードとして正しくない場合に発生します。

//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse_file(__FILE__)
# => (SCOPE@1:0-1:50
# tbl: []
# args: nil
# body:
# (FCALL@1:0-1:50 :pp
#...
...(LIST@1:3-1:50
# (CALL@1:3-1:50
# (COLON2@1:3-1:29 (CONST@1:3-1:9 :RubyVM) :AbstractSyntaxTree)
# :parse_file (LIST@1:41-1:49 (STR@1:41-1:49 "") nil)) nil)))
//}...

絞り込み条件を変える

RubyVM::AbstractSyntaxTree.parse_file(pathname, keep_script_lines: false, error_tolerant: false, keep_tokens: false) -> RubyVM::AbstractSyntaxTree::Node (3118.0)

pathname のファイルを読み込み、その内容を抽象構文木にパースし、その木の根ノードを返します。

...ise SyntaxError pathname から取得された文字列が Ruby のコードとして正しくない場合に発生します。

//emlist[][ruby]{
pp RubyVM::AbstractSyntaxTree.parse_file(__FILE__)
# => (SCOPE@1:0-1:50
# tbl: []
# args: nil
# body:
# (FCALL@1:0-1:50 :pp
#...
...(LIST@1:3-1:50
# (CALL@1:3-1:50
# (COLON2@1:3-1:29 (CONST@1:3-1:9 :RubyVM) :AbstractSyntaxTree)
# :parse_file (LIST@1:41-1:49 (STR@1:41-1:49 "") nil)) nil)))
//}...

Ruby プログラムの実行 (3061.0)

Ruby プログラムの実行 === Ruby プログラム

...Ruby プログラムの実行
=== Ruby プログラム

Ruby
プログラムの実行は文の連なりの評価です。なんらかの形であたえられたプログラムテキストをコンパイルし、BEGIN 文があればそれを評価し、トップレベルの式の連なりを評価...
...式は最後に評価した式の結果を返します。
最後に評価した式が値を返さない場合は nil を返します。

つまり Ruby では何度も「クラス定義の追加」をすることが可能です。

==== モジュール定義式

モジュールを定義します。...
...ル変数に代
入します。実際には省略されなかったら、与えられた値を同じくローカル変数
に代入します。

*args の形のパラメータ指定があるなら、残りの引数すべてを配列とし
てローカル変数に代入します。

さらに、ブ...
<< 1 2 3 ... > >>