クラス
- Array (21)
- Bignum (6)
- Fixnum (6)
- Integer (24)
-
RubyVM
:: InstructionSequence (24) - String (24)
-
Thread
:: Backtrace :: Location (24)
検索結果
先頭5件
-
String
# to _ i(base = 10) -> Integer (9140.0) -
文字列を 10 進数表現された整数であると解釈して、整数に変換します。
...6 進数表現へ変換できます。
それぞれ Ruby の整数リテラルで使用可能なプリフィクスは無視されます。
また、base に 0 を指定するとプリフィクスから基数を判断します。
認識できるプリフィクスは、
0b (2 進数)、0 (8 進数)、......(0) # => 16
//}
@param base 進数を指定する整数。0 か、2〜36 の整数。
@return 整数
このメソッドの逆に数値を文字列に変換するには、
Kernel.#sprintf, String#%, Integer#to_s
を使用します。
String#hex, String#oct, String#to_f,
Kernel.#Integer,... -
String
# unpack(template) -> Array (9063.0) -
Array#pack で生成された文字列を テンプレート文字列 template にしたがってアンパックし、 それらの要素を含む配列を返します。
...@param template pack テンプレート文字列
@return オブジェクトの配列
以下にあげるものは、Array#pack、String#unpack
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることができます......!<: little endian signed long
//}
=== 各テンプレート文字の説明
説明中、Array#pack と String#unpack で違いのあるものは `/' で区切って
「Array#pack の説明 / String#unpack の説明」としています。
: a
ASCII文字列(ヌル文字を詰める/後続する......6184].pack("Q*")
# => "\x01\x02\x03\x04\x05\x06\a\b\xFF\xFE\xFD\xFC\xFB\xFA\xF9\xF8"
//}
: m
base64された文字列。60 オクテットごと(と最後)に改行コードが付加されます。
Base64は、3オクテット(8bits * 3 = 24bits)のバイナリコードをASCII文字の
う......m template pack テンプレート文字列
@return オブジェクトの配列
以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることがで... -
RubyVM
:: InstructionSequence # base _ label -> String (6223.0) -
self が表す命令シーケンスの基本ラベルを返します。
...ed>@<compiled>>
iseq.base_label
# => "<compiled>"
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.base_label # => "<main>"......例3:
# /tmp/method2.rb
def hello
puts "hello, world"
end
RubyVM::InstructionSequence.of(method(:hello)).base_label
# => "hello"
@see RubyVM::InstructionSequence#label... -
Thread
:: Backtrace :: Location # base _ label -> String (6211.0) -
self が表すフレームの基本ラベルを返します。通常、 Thread::Backtrace::Location#label から修飾を取り除いたもので構成 されます。
...されます。
//emlist[例][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.base_label
end
# => initialize
# new
# <main>
//}
@see Thread::Backtrace::Location#label... -
Array
# pack(template , buffer: String . new) -> String (272.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...指定した場合は返値も指定した文字列オブジェクトになります。
以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることがで......!<: little endian signed long
//}
=== 各テンプレート文字の説明
説明中、Array#pack と String#unpack で違いのあるものは `/' で区切って
「Array#pack の説明 / String#unpack の説明」としています。
: a
ASCII文字列(ヌル文字を詰める/後続する......6184].pack("Q*")
# => "\x01\x02\x03\x04\x05\x06\a\b\xFF\xFE\xFD\xFC\xFB\xFA\xF9\xF8"
//}
: m
base64された文字列。60 オクテットごと(と最後)に改行コードが付加されます。
Base64は、3オクテット(8bits * 3 = 24bits)のバイナリコードをASCII文字の
う... -
Integer
# inspect(base=10) -> String (219.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 以外の数値を指定した場合に発生します。... -
Integer
# to _ s(base=10) -> String (219.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 以外の数値を指定した場合に発生します。... -
Bignum
# inspect(base = 10) -> String (213.0) -
self を引数で指定した基数の文字列表現に変換します。
...self を引数で指定した基数の文字列表現に変換します。
@param base 基数を 2 から 36 の整数で指定します。
12345654321.to_s #=> "12345654321"
12345654321.to_s(2) #=> "1011011111110110111011110000110001"
12345654321.to_s(8) #=> "133766736... -
Bignum
# to _ s(base = 10) -> String (213.0) -
self を引数で指定した基数の文字列表現に変換します。
...self を引数で指定した基数の文字列表現に変換します。
@param base 基数を 2 から 36 の整数で指定します。
12345654321.to_s #=> "12345654321"
12345654321.to_s(2) #=> "1011011111110110111011110000110001"
12345654321.to_s(8) #=> "133766736... -
Fixnum
# inspect(base = 10) -> String (213.0) -
self を引数で指定した基数の文字列表現に変換します。
...self を引数で指定した基数の文字列表現に変換します。
@param base 基数を 2 から 36 の整数で指定します。
12345.to_s #=> "12345"
12345.to_s(2) #=> "11000000111001"
12345.to_s(8) #=> "30071"
12345.to_s(10) #=> "12345"
12345.to_s(16)... -
Fixnum
# to _ s(base = 10) -> String (213.0) -
self を引数で指定した基数の文字列表現に変換します。
...self を引数で指定した基数の文字列表現に変換します。
@param base 基数を 2 から 36 の整数で指定します。
12345.to_s #=> "12345"
12345.to_s(2) #=> "11000000111001"
12345.to_s(8) #=> "30071"
12345.to_s(10) #=> "12345"
12345.to_s(16)... -
Array
# pack(template) -> String (172.0) -
配列の内容を template で指定された文字列にしたがって、 バイナリとしてパックした文字列を返します。
...指定した場合は返値も指定した文字列オブジェクトになります。
以下にあげるものは、Array#pack、String#unpack、String#unpack1
のテンプレート文字の一覧です。テンプレート文字は後に「長さ」を表す数字
を続けることがで......!<: little endian signed long
//}
=== 各テンプレート文字の説明
説明中、Array#pack と String#unpack で違いのあるものは `/' で区切って
「Array#pack の説明 / String#unpack の説明」としています。
: a
ASCII文字列(ヌル文字を詰める/後続する......6184].pack("Q*")
# => "\x01\x02\x03\x04\x05\x06\a\b\xFF\xFE\xFD\xFC\xFB\xFA\xF9\xF8"
//}
: m
base64された文字列。60 オクテットごと(と最後)に改行コードが付加されます。
Base64は、3オクテット(8bits * 3 = 24bits)のバイナリコードをASCII文字の
う...