種類
- 文書 (102)
- インスタンスメソッド (33)
- モジュール関数 (33)
- ライブラリ (11)
ライブラリ
- ビルトイン (66)
クラス
- String (11)
-
Thread
:: Backtrace :: Location (11) - TracePoint (11)
モジュール
- Kernel (33)
キーワード
- % (11)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) -
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (9) -
NEWS for Ruby 2
. 7 . 0 (5) - format (11)
- irb (11)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 2 feature (11) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 feature (11) - sprintf (11)
- sprintf フォーマット (11)
- クラス/メソッドの定義 (11)
検索結果
先頭5件
-
Kernel
. # `(command) -> String (18162.0) -
command を外部コマンドとして実行し、その標準出力を文字列として 返します。このメソッドは `command` の形式で呼ばれます。
...command を外部コマンドとして実行し、その標準出力を文字列として
返します。このメソッドは `command` の形式で呼ばれます。
引数 command に対しダブルクォートで囲まれた文字列と同様の解釈と式展開を行った後、
コマンド......必要がなく、単にコマンドを実行したいだけなら
Kernel.#system を使います。特に端末を制御するコマンドでは
`command` は失敗するかもしれません。
d:spec/literal#command も参照。
@param command コマンドとして実行する引数です。そ......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.#exec,Kernel.#spawn... -
Thread
:: Backtrace :: Location # inspect -> String (18119.0) -
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。
...][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.inspect
end
# => "path/to/foo.rb:5:in `initialize'"
# "path/to/foo.rb:9:in `new'"
# "path/to/foo.rb:9:in `<main>'"
//}... -
TracePoint
# inspect -> String (18113.0) -
self の状態を人間に読みやすい文字列にして返します。
...self の状態を人間に読みやすい文字列にして返します。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.inspect # "#<TracePoint:call `foo'@/path/to/test.rb:1>"
end
trace.enable
foo 1
//}... -
ruby 1
. 6 feature (264.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]......; make sure
ruby 1.6.7 (2002-05-04) [i586-linux]
"\\t"
nil
: 2002-04-20: Regexp#inspect
/x フラグ付きの正規表現オブジェクトの inspect が改行を \n に変換して
いました。((<ruby-bugs-ja:PR#225>))
p /a
b/x... -
ruby 1
. 8 . 4 feature (144.0) -
ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。
...-:1: empty symbol literal
: Symbol [bug]
#Sat Oct 22 13:26:57 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
#
# * object.c (sym_inspect), parse.y (parser_yylex, rb_symname_p): check
# if valid as a symbol name more strictly. [ruby-dev:27478]
#
# * test/ruby/test_sym......2) Symbol#inspect sometimes returns invalid symbol representations:
puts :"!".inspect
puts :"=".inspect
puts :"0".inspect
puts :"$1".inspect
puts :"@1".inspect
puts :"@@1".inspect
puts :"@".inspect
p......-: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... -
irb (108.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...示する (デフォルト)
--noecho 実行結果を表示しない
--inspect 結果出力にinspectを用いる (bc モード以外ではデフォルト)
--noinspect 結果出力にinspectを用いない
--readline readlineライブラリを利用する
--nor......= nil
IRB.conf[:EVAL_HISTORY] = nil
IRB.conf[:HISTORY_FILE] = nil
IRB.conf[:IGNORE_EOF] = true
IRB.conf[:IGNORE_SIGINT] = true
IRB.conf[:INSPECT_MODE] = nil
IRB.conf[:IRB_NAME] = "irb"
IRB.conf[:IRB_RC] = nil
IRB.conf[:MATH_MODE] = false
IRB.conf[:PROMPT] = {....}
IRB.conf[:PROMP......: %m
main オブジェクト (self) を to_s した文字列
: %M
main オブジェクト (self) を inspect した文字列
: %l
文字列中のタイプを表す (", ', /, ], `]'は%wの中の時)
: %NNi
インデントのレベルを、NN 桁に右詰めした文字列。
NN......実行結果を表示する (デフォルト)
--noecho 実行結果を表示しない
--inspect 結果出力にinspectを用いる
--noinspect 結果出力にinspectを用いない
--readline readlineライブラリを利用する
--noreadline readline......= nil
IRB.conf[:EVAL_HISTORY] = nil
IRB.conf[:HISTORY_FILE] = nil
IRB.conf[:IGNORE_EOF] = true
IRB.conf[:IGNORE_SIGINT] = true
IRB.conf[:INSPECT_MODE] = nil
IRB.conf[:IRB_NAME] = "irb"
IRB.conf[:IRB_RC] = nil
IRB.conf[:PROMPT] = {....}
IRB.conf[:PROMPT_MODE] = :DEFAULT
IRB.conf[:... -
NEWS for Ruby 2
. 3 . 0 (102.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 を......10714
* Array#flatten と Array#flatten! は与えられたレベルを越えた要素には
`#to_ary`を呼ばないようになりました。
10748
* Array#inspect はその要素の文字列が Encoding.default_external と
互換性のないエンコーディン... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (84.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......ス/メソッド(互換性のある変更)
=== 組み込み関数
: ((<組み込み関数/sprintf>)) [new]
"%p" が追加されました。inspect の結果が利用されます。((<RCR#69>))
: ((<組み込み関数/trap>)) [compat]
あるシグナルに対して、SIG_DFL や SIG_IGN... -
ruby 1
. 9 feature (42.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...[obsolete]: 廃止された(される予定の)機能
* [platform]: 対応プラットフォームの追加
== 1.9.0
=== 2006-09-16
: Struct#inspect
=== 2006-09-14
: digest.rb
: Digest::Base.file
=== 2006-09-13
: Hash#compare_by_identity
: Hash#compare_by_identity?
: Hash#identical
: Hash#......: エラー表示で、true/false/nil が self の場合の表示が変わりました
: UnboundMethod#bind で生成したものでも Method#inspect でちゃんとなるようになりました ((<ruby-dev:28636>))
: 丸めエラー修正 ((<ruby-core:07896>))
: divmod 修正 ((<ruby-dev:......x]
-:1:in `system': No such file or directory - hogehoge (Errno::ENOENT)
from -:1
p system("/tmp")
# => ruby 1.8.2 (2004-07-17) [i586-linux]
false
# => ruby 1.9.0 (2004-07-17) [i586-linux]
-:1:in `system': Permission de... -
クラス/メソッドの定義 (42.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...][ruby]{
class Foo < Super
def test
# ...
end
# ...
end
//}
文法:
class 識別子 [`<' superclass ]
式..
end
文法:
class 識別子 [`<' superclass ]
式..
[rescue [error_type,..] [=> evar] [then]
式..]........Object.new # obj = nil でも可
class << obj
def test
# ...
end
# ...
end
//}
文法:
class `<<' expr
式..
end
文法:
class `<<' expr
式..
[rescue [error_type,..] [=> evar] [then]
式..]..
[else......れる機能です。
このような引数は 1 つしか作れません。
//emlist[例][ruby]{
def foo(x, *xs)
puts "#{x} : #{xs.inspect}" # Object#inspect は p のような詳細な内部表示
end
foo(1) #=> 1 : []
foo(1, 2) #=> 1 : [2]
foo(1, 2, 3) #=> 1 : [2, 3]
def bar(x,...