るりまサーチ

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

別のキーワード

  1. kernel `
  2. _builtin `
  3. ` kernel
  4. ` _builtin

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

Kernel.#`(command) -> String (18156.0)

command を外部コマンドとして実行し、その標準出力を文字列として 返します。このメソッドは `command` の形式で呼ばれます。

...command を外部コマンドとして実行し、その標準出力を文字列として
返します。このメソッドは `command` の形式で呼ばれます。

引数 command に対しダブルクォートで囲まれた文字列と同様の解釈と式展開を行った後、
コマンド...
...必要がなく、単にコマンドを実行したいだけなら
Kernel.#system を使います。特に端末を制御するコマンドでは
`
command` は失敗するかもしれません。

d:spec/literal#command も参照。

@param command コマンドとして実行する引数です。そ...
...返します。
@raise Errno::EXXX コマンドを実行できないときや失敗した場合に発生します。

//emlist[例][ruby]{
puts `ruby -v` #=> ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
puts $?.inspect #=> #<Process::Status: pid=3580,exited(0)>
//}

@see Kernel.#system,Kernel...

Kernel$$` -> String | nil (6100.0)

現在のスコープで最後に成功した正規表現のパターンマッチでマッチした 部分より前の文字列です。 最後のマッチが失敗していた場合には nil となります。

...す。

この変数はローカルスコープかつスレッドローカル、読み取り専用です。
Ruby起動時の初期値は nil です。

//emlist[例][ruby]{
str = '<p><a href="http://example.com">example.com</a></p>'
if %r[<a href="(.*?)">(.*?)</a>] =~ str
p $`
end
#=> "<p>"
//}...

NEWS for Ruby 3.0.0 (510.0)

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

...ts forwarding (`...`) now supports leading arguments.
16378

//emlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end
//}

* Pattern matching (`case/in`) is no longer experimental. 17260
* One-line pattern matching is redesigned. [EXPERIMENTAL]
* `=>` is added. It...
...can be used like a rightward assignment.
17260
* `in` is changed to return `true` or `false`. 17371

//emlist{
0 => a
p a #=> 0

{b: 0, c: 1} => {b:}
p b #=> 0
//}

//emlist{
# version 3.0
0 in 1 #=> false

# version 2.7
0 in 1 #=> raise NoMatchingPatternError
//}

* Find-pattern i...
...16746

//emlist{
def square(x) = x * x
//}

* Interpolated String literals are no longer frozen when
`
# frozen-string-literal: true` is used. 17104
* Magic comment `shareable_constant_value` added to freeze constants.
See {Magic Comments}[rdoc-ref:doc/syntax/comments.rdoc@Magic+Comments]...

ruby 1.6 feature (246.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...らこちらは nil を返していた
p "foo".slice!(5,10)

=> ruby 1.6.7 (2002-03-01) [i586-linux]
nil
-:2:in `slice!': index 5 out of string (IndexError)
from -:2
=> ruby 1.6.7 (2002-08-01) [i586-linux]
nil
nil

:...
...用します。以前までは $; が有効にな
るのは引数省略時だけでした。

$; = ":"
p "a:b:c".split(nil)
=> -:2:in `split': bad separator (ArgumentError)
from -:2
ruby 1.6.7 (2002-03-01) [i586-linux]

=> ruby 1.6.7 (2002-07-30) [i586-linux]...
...y"
h = Hash[a,"val"]
h.keys[0].upcase!
p a
=> ruby 1.6.7 (2002-03-01) [i586-linux]
"KEY"
=> -:3:in `upcase!': can't modify frozen string (TypeError)
from -:3
ruby 1.6.7 (2002-08-01) [i586-linux]

: 2002-06-10 Fixnum#>>, <<...

NEWS for Ruby 3.1.0 (228.0)

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

...。このコードでは、

//emlist[][ruby]{
foo[0] = bar
//}

* 次の評価順序になります。

//emlist{
1. `foo`
2. `bar`
3. `[]=` called on the result of `foo`
//}

* Ruby 3.1.0より前は、多重代入の評価順序が上記のようではありませんでした。この...
...`a`
2. `b`
3. `foo`
4. `[]=` called on the result of `foo`
5. `bar`
6. `baz=` called on the result of `bar`
//}

* Ruby 3.1.0から単一代入と評価順序が一致するようになり、左が右より先に評価されます。

//emlist{
1. `foo`
2. `bar`
3. `a`
4. `b`...
...5. `[]=` called on the result of `foo`
6. `baz=` called on the result of `bar`
//}

* 4443

* ハッシュリテラルやキーワード引数の値が省略可能になりました。 14579

* {x:, y:} は {x: x, y: y} の糖衣構文です。
* foo(x:, y:) は foo(x: x, y: y) の糖...

絞り込み条件を変える

NEWS for Ruby 2.3.0 (90.0)

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

...、自動的に他の似た名前を提案してくれます。
//emlist{
"Yuki".starts_with?("Y")
# => NoMethodError: undefined method `starts_with?' for "Yuki":String
# Did you mean? start_with?
//}

* インデントされたヒアドキュメント:
* 新しい文字...
...トが追加されました
9098

=== 組み込みクラスの更新

* ARGF
* ARGF.read_nonblock は IO#read_nonblock と同じように `exception: false' オプションをサポートします
11358

* Array
* Array#bsearch_index を追加
10730
* Array#dig を...
...とを許可しますが、現在はファイルをバイナリモードで開いているときのみ効果があります。
11218
* `flags` オプションの追加。
this parameter is bitwise-ORed to oflags generated by normal mode argument.
11253
* IO#advise はもは...

optparse (90.0)

コマンドラインのオプションを取り扱うためのライブラリです。

...e.rb:1428:in `complete': invalid option: -c (OptionParser::InvalidOption)
from /usr/local/lib/ruby/1.9/optparse.rb:1426:in `catch'
from /usr/local/lib/ruby/1.9/optparse.rb:1426:in `complete'
from /usr/local/lib/ruby/1.9/optparse.rb:1287:in `order!'...
...n `catch'
from /usr/local/lib/ruby/1.9/optparse.rb:1256:in `order!'
from /usr/local/lib/ruby/1.9/optparse.rb:1336:in `permute!'
from /usr/local/lib/ruby/1.9/optparse.rb:1363:in `parse!'
from /usr/local/lib/ruby/1.9/optparse.rb:1356:in `...
...se.rb:455:in `parse': missing argument: -a (OptionParser::MissingArgument)
from /usr/local/lib/ruby/1.9/optparse.rb:1295:in `order!'
from /usr/local/lib/ruby/1.9/optparse.rb:1256:in `catch'
from /usr/local/lib/ruby/1.9/optparse.rb:1256:in `order!'...

ruby 1.8.4 feature (66.0)

ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。

...-:3:in `foo': method `foo' called on terminated object (0xb7e06970) (NotImplementedError)
from -:7
# => ruby 1.8.4 (2005-12-22) [i686-linux]
-:3:in `foo'-:3: warning: too many arguments for format string
: super: no superclass method `foo' (NoMe...
...Bar.new

# => ruby 1.8.3 (2005-09-21) [i686-linux]
-:3:in `initialize': method `initialize' called on terminated object (0xb7dd2bec) (NotImplementedError)
from -:10:in `initialize'
from -:14
# => ruby 1.8.4 (2005-12-16) [i686-linux...
...printf("%2147483648$d\n") # -e:1:in `printf': invalid index - -2147483648$ (ArgumentError)
printf("%2147483649$d\n") # -e:1:in `printf': invalid index - -2147483647$ (ArgumentError)
printf("%4294967296$d\n") # -e:1:in `printf': invalid index - 0$ (ArgumentError)...

1.6.8から1.8.0への変更点(まとめ) (60.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...Proc.new {|a,b,c| p [a,b,c]}.call(1,2)
=> -:1: wrong # of arguments (2 for 3) (ArgumentError)
from -:1:in `call'
from -:1
ruby 1.6.8 (2002-12-24) [i586-linux]
=> ruby 1.8.0 (2003-06-21) [i586-linux...
...[1, 2, nil]

Proc.new { break }.call

=> ruby 1.6.8 (2002-12-24) [i586-linux]

=> -:1:in `call': break from proc-closure (LocalJumpError)
from -:1
ruby 1.8.0 (2003-06-21) [i586-linux]

* lam...
...entError)
from -:1:in `call'
from -:1
ruby 1.6.8 (2002-12-24) [i586-linux]
=> -:1: wrong number of arguments (2 for 3) (ArgumentError)
from -:1:in `call'
from -:1...

Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (48.0)

Rubyで使われる記号の意味(正規表現の複雑な記号は除く) ex q num per and or  plus minus ast slash hat sq  period comma langl rangl eq tilde  dollar at under lbrarbra  lbra2rbra2 lbra3rbra3 dq colon ac  backslash semicolon

...!nomad! #=> "nomad"
//}

: % ruby -e "puts 'Hello'"

コマンドラインへの入力を示す。rubyスクリプト上で入力を行うには `command` や system(command) などと書く

===[a:and] &

: xxx & yyy

論理積演算子。または類似の演算を行うメソッド。
//emlist{...
...EOS または <<-EOS 、<<"EOS" など。

ヒアドキュメントです。d:spec/literal#here。ヒアドキュメントは `<<識別子' を含む行の次の行から
`
識別子' だけの行の直前までを文字列とする行指向のリテラルです。

: class Foo < Super

クラス...
...yyy

識別子の中では小文字と同じ扱い

: 123_456

文字コード以外の数値リテラルには、`_' を含めることができます。 ruby インタプリタは `_' を単に無視し、
特別な解釈は何もしません。 これは、大きな数値の桁数がひと目...

絞り込み条件を変える

Rubyの起動 (48.0)

Rubyの起動 * cmd_option * shebang

...gramfile は、Ruby スクリプトを記述したファイ
ルです。これを省略したり`-' を指定した場合には標準入力を Ruby ス
クリプトとみなします。

programfile が `#!' で始まるファイルである場合、特殊な解釈
が行われます。詳細は後...
...ンタプリタが自前でワイルドカードを展開して
Object::ARGV に設定します。この場合ワイルドカードとして
`
*', `?', `[]', `**/' が使用できます。Win32 環境で、
ワイルドカード展開を抑止したい場合は引数をシングルクォート(') で...
...同じ)に設定できます。

: -a

`
-n'や`-p'とともに用いて, オートスプリットモードをONにします。
オートスプリットモードでは各ループの先頭で,
//emlist{
$F = $_.split
//}
が実行されます。`-n'か`-p'オプションが同時に指定...

ruby 1.8.3 feature (42.0)

ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))

...密にするようになりました。

$ ruby-1.8.2 -e 'p File.join(1, 2)'
"1/2"

$ ruby-1.8.3 -e 'p File.join(1, 2)'
-e:1:in `join': can't convert Fixnum into String (TypeError)
from -e:1

=== 2005-09-16
: File.extname [ruby] [compat]

与えられた pathname...
...p $SAFE
Hoge.new.foo

$ ruby-1.8.2 mthd_taint.rb
0
"safe level: 0"

$ ruby-1.8.3 mthd_taint.rb
0
mthd_taint.rb:11:in `foo': calling insecure method: foo (SecurityError)
from mthd_taint.rb:11

=== 2005-09-09
: String#* [ruby] [compat]
: String#[] [ruby] [...
...r.new(foo)
def foo.bar
puts "bar"
end
foo2.bar

$ ruby-1.8.2 -r delegate test_dlg.rb
test_dlg.rb:6: undefined method `bar' for #<Object:0x4021b0a0> (NoMethodError)

$ ruby-1.8.3 -r delegate test_dlg.rb
bar

=== 2005-06-20
: DBM#closed? [lib] [new]
: GDBM#...
<< 1 2 3 ... > >>