507件ヒット
[1-100件を表示]
(0.088秒)
種類
- インスタンスメソッド (386)
- モジュール関数 (77)
- 文書 (44)
ライブラリ
- ビルトイン (357)
-
minitest
/ unit (1) -
net
/ smtp (11) - optparse (11)
- ostruct (22)
- pp (11)
- rake (22)
-
shell
/ filter (6) - strscan (11)
- win32ole (11)
クラス
- Bignum (6)
-
Encoding
:: Converter (11) - Fixnum (6)
- Float (22)
- Integer (22)
- Method (22)
- Module (33)
-
Net
:: SMTP (11) - Object (22)
- OpenStruct (22)
-
OptionParser
:: ParseError (11) -
Rake
:: TaskArguments (22) - Range (22)
- Rational (22)
- Regexp (22)
-
RubyVM
:: AbstractSyntaxTree :: Node (6) -
RubyVM
:: InstructionSequence (11) -
Shell
:: Filter (6) - String (22)
- StringScanner (11)
- Thread (9)
-
Thread
:: Backtrace :: Location (11) - UnboundMethod (22)
-
WIN32OLE
_ TYPE (11)
モジュール
- Kernel (77)
-
MiniTest
:: Assertions (1)
キーワード
- % (11)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - ` (11)
- format (11)
-
mu
_ pp (1) - name (11)
- name= (9)
-
pretty
_ print _ inspect (11) -
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 4 feature (11) - sprintf (11)
-
to
_ s (116) -
trace
_ var (33) -
untrace
_ var (11) - クラス/メソッドの定義 (11)
検索結果
先頭5件
-
String
# inspect -> String (39244.0) -
文字列オブジェクトの内容を、出力したときに人間が読みやすいような適当な形式に変換します。 変換された文字列は印字可能な文字のみによって構成されます
...ために用意されています。
永続化などの目的で文字列をダンプしたいときは、
String#dump を使うべきです。
//emlist[例][ruby]{
# p ではないことに注意
puts "string".inspect # => "string"
puts "\t\r\n".inspect # => "\t\r\n"
//}
@see String#dump... -
StringScanner
# inspect -> String (21262.0) -
StringScannerオブジェクトを表す文字列を返します。
...StringScannerオブジェクトを表す文字列を返します。
文字列にはクラス名の他、以下の情報が含まれます。
* スキャナポインタの現在位置。
* スキャン対象の文字列の長さ。
* スキャンポインタの前後にある文字。......記実行例の @ がスキャンポインタを表します。
//emlist[例][ruby]{
require 'strscan'
s = StringScanner.new('test string')
s.inspect # => "#<StringScanner 0/11 @ \"test ...\">"
s.scan(/\w+/) # => "test"
s.inspect......# => "#<StringScanner 4/11 \"test\" @ \" stri...\">"
s.scan(/\s+/) # => " "
s.inspect # => "#<StringScanner 5/11 \"test \" @ \"strin...\">"
s.scan(/\w+/) # => "string"
s.inspect # => "#<StringScanner... -
String
# %(args) -> String (21125.0) -
printf と同じ規則に従って args をフォーマットします。
....#sprintf(self, *args) と同じです。
それ以外の場合は Kernel.#sprintf(self, args) と同じです。
@param args フォーマットする値、もしくはその配列
@return フォーマットされた文字列
//emlist[例][ruby]{
p "i = %d" % 10 # => "i = 10"
p "......意味を持ちます。
: s
文字列を出力します。
引数が String オブジェクトでなければ to_s メソッドにより文字列化
したものを引数として扱います。
: p
Object#inspect の結果を出力します。
//emlist[][ruby]{
p sprintf("%s", /e+/) #=>... -
Object
# inspect -> String (18250.0) -
オブジェクトを人間が読める形式に変換した文字列を返します。
...して
オブジェクトを表示します。
//emlist[][ruby]{
[ 1, 2, 3..4, 'five' ].inspect # => "[1, 2, 3..4, \"five\"]"
Time.new.inspect # => "2008-03-08 19:43:39 +0900"
//}
inspect メソッドをオーバーライドしなかった場合、クラス名とインスタン......変数の名前、値の組を元にした文字列を返します。
//emlist[][ruby]{
class Foo
end
Foo.new.inspect # => "#<Foo:0x0300c868>"
class Bar
def initialize
@bar = 1
end
end
Bar.new.inspect # => "#<Bar:0x0300c868 @bar=1>"
//}
@see Kernel.#p... -
UnboundMethod
# inspect -> String (18239.0) -
self を読みやすい文字列として返します。
...self を読みやすい文字列として返します。
詳しくは Method#inspect を参照してください。
//emlist[例][ruby]{
String.instance_method(:count).inspect # => "#<UnboundMethod: String#count>"
//}
@see Method#inspect... -
Rational
# inspect -> String (18238.0) -
自身を人間が読みやすい形の文字列表現にして返します。
...に10進数の表記を返します。
@return 有理数の表記にした文字列を返します。
//emlist[例][ruby]{
Rational(5, 8).inspect # => "(5/8)"
Rational(2).inspect # => "(2/1)"
Rational(-8, 6).inspect # => "(-4/3)"
Rational(0.5).inspect # => "(1/2)"
//}
@see Rational#to_s... -
Range
# inspect -> String (18236.0) -
self を文字列に変換します(始端と終端のオブジェクトは #inspect メソッド で文字列に変換されます)。
...self を文字列に変換します(始端と終端のオブジェクトは #inspect メソッド
で文字列に変換されます)。
@see Range#to_s
//emlist[例][ruby]{
(1..5).inspect # => "1..5"
("1".."5").inspect # => "\"1\"..\"5\""
//}... -
Net
:: SMTP # inspect -> String (18234.0) -
@see Object#inspect
...@see Object#inspect... -
Method
# inspect -> String (18233.0) -
self を読みやすい文字列として返します。
...式の文字列を返します。
#<Method: klass1(klass2)#method> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。
klass2......# スーパークラスのクラスメソッド
class Bar < Foo
end
p Bar.method(:foo) # => #<Method: Bar.foo>
# 以下は(形式1)の出力になる
module Baz
def baz
end
end
class <<obj
include Baz
end
p obj.method(:baz) # => #<Method: Object(Baz)#baz>
//}
@see Object#inspect......の文字列を返します。
#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。
klass2......ラスメソッド
class Bar < Foo
end
p Bar.method(:foo) # => #<Method: Bar(Foo).foo() foo.rb:11>
# 以下は(形式1)の出力になる
module Baz
def baz
end
end
class <<obj
include Baz
end
p obj.method(:baz) # => #<Method: String(Baz)#baz() foo.rb:23>
//}
@see Object#inspect... -
Integer
# inspect(base=10) -> String (18221.0) -
整数を 10 進文字列表現に変換します。
...[][ruby]{
p 10.to_s(2) # => "1010"
p 10.to_s(8) # => "12"
p 10.to_s(16) # => "a"
p 35.to_s(36) # => "z"
//}
@return 数値の文字列表現
@param base 基数となる 2 - 36 の数値。
@raise ArgumentError base に 2 - 36 以外の数値を指定した場合に発生します。...