るりまサーチ

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

別のキーワード

  1. format spec
  2. format spec=
  3. installer spec
  4. oldformat spec
  5. uninstaller spec

モジュール

検索結果

<< 1 2 3 ... > >>

正規表現 (23240.0)

正規表現 * metachar * expansion * char * anychar * string * str * quantifier * capture * grouping * subexp * selector * anchor * cond * option * encoding * comment * free_format_mode * absenceop * list * specialvar * references

...capture
* grouping
* subexp
* selector
* anchor
* cond
* option
* encoding
* comment
* free_format_mode
* absenceop
* list
* specialvar
* references


正規表現(regular expression)は文字列のパターンを記述するための言語です。
また、この言語で...
...Ruby の文法で特別な意味を持つ文字を埋め込む
ためなどに用いられます。
文字列リテラルの記法とほぼ同様(d:spec/literal#backslash)で、
以下の記法が利用可能です。

\t 水平タブ horizontal tab (0x09)
\v 垂...
...ティ(属性情報)による文字クラス指定も可能です。
以下の記法が使えます。
* \p{property-name}
* \p{^property-name} (否定)
* \P{property-name} (否定)
サポートされているプロパティのリストは
https://github.com/k-takata/Onigmo/blob/master/doc/Uni...

クラス/メソッドの定義 (23066.0)

クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined

...ァベットの大文字で始まる識別子です。

rescue/ensure 節を指定し、例外処理ができます。
例外処理についてはd:spec/control#begin参照。

クラス定義は、識別子で指定した定数へのクラスの代入になります
(Ruby では、クラスもオ...
...たオブジェクトには引き継がれません.

rescue/ensure 節を指定し、例外処理ができます。
例外処理についてはd:spec/control#begin参照。

特異クラス定義式は、最後に評価した式の結果を返します。最後に評価した式
が値を返さ...
...を参照してください。

//emlist[][ruby]{
class Foo
def foo
def bar
p :bar
end
end

def Foo.method_added(name)
puts "method \"#{name}\" was added"
end
end
obj = Foo.new
obj.bar rescue nil # => undefined method `bar' for #<Foo:0x4019eda4>
obj.foo # => meth...

パターンマッチ (23048.0)

パターンマッチ * patterns * variable_binding * variable_pinning * matching_non_primitive_objects * guard_clauses * current_feature_status * pattern_syntax * some_undefined_behavior_examples

...ハッシュにマッチして、その値を変数userに代入する
puts "Connect with user '#{user}'"
in connection: {username: }
puts "Connect with user '#{username}'"
else
puts "Unrecognized structure of config"
end
# "Connect with user 'admin'" と出力
//}

一方、『=>』 演算子...
...パターンにマッチするかどうかだけを知りたいときに使えます。

//emlist{
users = [{name: "Alice", age: 12}, {name: "Bob", age: 23}]
users.any? {|user| user in {name: /B/, age: 20..} } #=> true
//}

構文の詳細な例と説明は以下を参照してください。

===[...
...d

def deconstruct
puts "deconstruct called"
[@x, @y]
end

def deconstruct_keys(keys)
puts "deconstruct_keys called with #{keys.inspect}"
{x: @x, y: @y}
end
end

case Point.new(1, -2)
in px, Integer # パターンと変数への束縛も動きます
"matched: #{px}"
else...

リテラル (23048.0)

リテラル * num * string * backslash * exp * char * command * here * regexp * array * hash * range * symbol * percent

...中に改行を含めずに改行

====[a:exp] 式展開

//emlist[例][ruby]{
# ($ruby = "RUBY"の場合)

"my name is #{$ruby}" #=> "my name is RUBY"
'my name is #{$ruby}' #=> "my name is #{$ruby}"
//}

ダブルクォート(")で囲まれた文字列式、コマンド文
字列および正規表...
...規表現リテラル

//emlist[例][ruby]{
/^Ruby the OOPL/
/Ruby/i
/my name is #{myname}/o
%r|Ruby|
//}

/で囲まれた文字列は正規表現です。正規表現として解釈される
メタ文字についてはspec/regexpを参照してください。

終りの/の直後の文字は正規...
...ッシュ式は評価されるたびに毎回新しいハッシュオブジェクトを生成します。

===[a:range] 範囲オブジェクト

d:spec/operator#rangeを参照

範囲式はその両端が数値リテラルであれば、何度評価されても同じオブジェク
トを返しま...
...とができます。

//emlist[][ruby]{
expected_result = <<~SQUIGGLY_HEREDOC
This would contain specially formatted text.

That might span many lines
SQUIGGLY_HEREDOC
# => "This would contain specially formatted text.\n" + "\n" + "That might span many lines\n"
//}

最もインデントが少...

パターンマッチ (23030.0)

パターンマッチ * patterns * variable_binding * variable_pinning * matching_non_primitive_objects * guard_clauses * current_feature_status * pattern_syntax * some_undefined_behavior_examples

...ハッシュにマッチして、その値を変数userに代入する
puts "Connect with user '#{user}'"
in connection: {username: }
puts "Connect with user '#{username}'"
else
puts "Unrecognized structure of config"
end
# "Connect with user 'admin'" と出力
//}

一方、『in』 文は、...
...ストしたパターンの場合も同様に値の束縛を利用できます。

//emlist[][ruby]{
case {name: 'John', friends: [{name: 'Jane'}, {name: 'Rajesh'}]}
in name:, friends: [{name: first_friend}, *]
"matched: #{first_friend}"
else
"not matched"
end
#=> "matched: Jane"
//}

パター...
...d

def deconstruct
puts "deconstruct called"
[@x, @y]
end

def deconstruct_keys(keys)
puts "deconstruct_keys called with #{keys.inspect}"
{x: @x, y: @y}
end
end

case Point.new(1, -2)
in px, Integer # パターンと変数への束縛も動きます
"matched: #{px}"
else...

絞り込み条件を変える

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

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

...ルの式の連なりを評価し、END ブロックがあれば最後にそれを評価して終了します (終了処理の詳細については spec/terminate を参照のこと)。

=== 文

==== if

if 文は、まず条件式を評価し、その値が真ならば対応する本体を評価...
...== クラス定義式

クラスを定義します。
評価は(コンパイル時ではなく)実行時に行われます。

書式

class ClassName [< スーパークラス式]

end

クラス定義式は評価されるとまずクラスを生成しようとします。スーパーク...
...パークラスが
(equal? において) 違う場合は例外 TypeError が発生します。

クラスを得たら次にそれを定数「ClassName」に代入します。これによってク
ラス名が決定されます。このとき同名の定数に Class のインスタンスでない
...

多言語化 (23006.0)

多言語化 Ruby は US-ASCII はもちろん、US-ASCII 以外の文字エンコーディングもサポートしています。 文字列の内部表現のエンコーディングは固定されておらず、 プログラマは目的に応じて使用するエンコーディングを選ぶことができます。

...態です。
ISO-2022-JP, UTF-7 がこれにあたります。

サポートするエンコーディングのリストは Encoding.list, Encoding.name_list
で取得することができます。
また拡張ライブラリを作成することによりサポートするエンコーディングを...

Gem::Specification#name -> String (21101.0)

この Gem パッケージの名前を返します。

この Gem パッケージの名前を返します。

Module#name -> String | nil (18143.0)

モジュールやクラスの名前を文字列で返します。

...ル / クラスに対しては、name は nil を、それ以外はオブジェクト ID の文字列を返します。

//emlist[例][ruby]{
module A
module B
end

p B.name #=> "A::B"

class C
end
end

p A.name #=> "A"
p A::B.name #=> "A::B"
p A::C.name #=> "A::C"

# 名前のない...
...モジュール / クラス
p Module.new.name #=> nil
p Class.new.name #=> nil
p Module.new.to_s #=> "#<Module:0x00007f90b09112c8>"
p Class.new.to_s #=> "#<Class:0x00007fa5c40b41b0>"
//}...

Gem::DependencyInstaller#find_spec_by_name_and_version(gem_name, version = Gem::Requirement.default) -> Array (12309.0)

与えられた Gem の名前とバージョンに関する条件にマッチする Gem::Specification と それの存在する URI を含む配列を返します。

...与えられた Gem の名前とバージョンに関する条件にマッチする Gem::Specification と
それの存在する URI を含む配列を返します。

@param gem_name Gem の名前を指定します。

@param version Gem が満たすバージョンに関する条件を指定しま...

絞り込み条件を変える

<< 1 2 3 ... > >>