るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< 1 2 3 ... > >>

OpenSSL::BN#to_s(base=10) -> String (21404.0)

自身を表す文字列を返します。

...ます。

b
ase で、変換方法(基数)を指定します。
デフォルトは 10 で、他に 16, 2, 0 を指定できます。

10 10進数の表記
16 16進数の表記
2 big-endianの符号無し整数のバイナリ列
0 MPI形式の文字列(バイト列)

@param base 文字...
...SSL::BNError 変換に失敗した場合に発生します

//emlist[][ruby]{
require 'openssl'

p 10.to_bn.to_s # => "10"
p (-5).to_bn.to_s # => "-5"

p 0.to_bn.to_s(16) # => "0"
p 9.to_bn.to_s(16) # => "09"
p 10.to_bn.to_s(16) # => "0A"
p 16.to_bn.to_s(16) # => "10"
p 26.to_bn.to_s(16)...
...256.to_bn.to_s(16) # => "0100"

p 0.to_bn.to_s(2) # => ""
p 6.to_bn.to_s(2) # => "\x06"
p 7.to_bn.to_s(2) # => "\a"

p 0.to_bn.to_s(0) # => "\x00\x00\x00\x00"
p 6.to_bn.to_s(0) # => "\x00\x00\x00\x01\x06"
p 7.to_bn.to_s(0) # => "\x00\x00\x00\x01\a"
//}

反対に、文字列から OpenSSL::BN ク...

BigDecimal#to_s -> String (21323.0)

self を文字列に変換します (デフォルトは "0.xxxxxen" の形になります)。

...//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("1.23456").to_s # ==> "0.123456e1"
//}

引数 n に正の整数が指定されたときは、小数点で分けられる左右部分を、
それぞれ n 桁毎に空白で区切ります。

//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("0....
...1234567890123456789").to_s(10) # => "0.1234567890 123456789e0"
//}

引数 n に正の整数を表す文字列を指定することもできます。

//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("0.1234567890123456789").to_s("10") # => "0.1234567890 123456789e0"
//}

文字列の最初に '+...
...' ' が付きます。負の場合は常に '-' が付きます。

//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("0.123456").to_s(" 3") # => " 0.123 456e0"
B
igDecimal("0.123456").to_s("+3") # => "+0.123 456e0"
B
igDecimal("-0.123456").to_s("3") # => "-0.123 456e0"
//}

さらに文字列の最...

BigDecimal#to_s(n) -> String (21323.0)

self を文字列に変換します (デフォルトは "0.xxxxxen" の形になります)。

...//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("1.23456").to_s # ==> "0.123456e1"
//}

引数 n に正の整数が指定されたときは、小数点で分けられる左右部分を、
それぞれ n 桁毎に空白で区切ります。

//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("0....
...1234567890123456789").to_s(10) # => "0.1234567890 123456789e0"
//}

引数 n に正の整数を表す文字列を指定することもできます。

//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("0.1234567890123456789").to_s("10") # => "0.1234567890 123456789e0"
//}

文字列の最初に '+...
...' ' が付きます。負の場合は常に '-' が付きます。

//emlist[][ruby]{
require "bigdecimal"
B
igDecimal("0.123456").to_s(" 3") # => " 0.123 456e0"
B
igDecimal("0.123456").to_s("+3") # => "+0.123 456e0"
B
igDecimal("-0.123456").to_s("3") # => "-0.123 456e0"
//}

さらに文字列の最...

Object#to_s -> String (21226.0)

オブジェクトの文字列表現を返します。

...使って文字列に変換し
ます。

//emlist[][ruby]{
class Foo
def initialize num
@num = num
end
end
it = Foo.new(40)

puts it #=> #<Foo:0x2b69110>

class Foo
def to_s
"Class:Foo Number:#{@num}"
end
end

puts it #=> Class:Foo Number:40
//}

@see Object#to_str,Kernel.#String...

Thread::Backtrace::Location#to_s -> String (21220.0)

self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。

...//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.to_s
end

# => path/to/foo.rb:5:in `initialize'
# path/to/foo.rb:9:in `new'
# path/to/foo.rb:9:in `<main>'...

絞り込み条件を変える

Digest::Base#to_s -> String (18232.0)

updateや<<によって追加した文字列に対するハッシュ値を、 ASCIIコードを使って16進数の列を示す文字列にエンコードして返します。

...バイト長です。

Ruby
で書くと以下と同じです。

def hexdigest
digest.unpack("H*")[0]
end

例:

# MD5の場合
require 'digest/md5'
digest = Digest::MD5.new
digest.update("ruby")
p digest.hexdigest # => "58e53d1324eef6265fdb97b08ed9aadf"

@see Digest::Base#digest...

Rake::FileList#to_s -> String (18232.0)

全ての要素をスペースで連結した文字列を返します。

...全ての要素をスペースで連結した文字列を返します。

//emlist[][ruby]{
# Rakefile での記載例とする

task default: :test_rake_app
task :test_rake_app do
file_list = FileList['a.c', 'b.c']
file_list.to_s # => "a.c b.c"
end
//}...

CSV::Table#to_s(options = Hash.new) -> String (18226.0)

CSV の文字列に変換して返します。

...ションに :write_headers =>
false を指定するとヘッダを出力しません。

//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.to_csv # => "a,b,c\n1,2,3\n"
p table.to_csv(write_headers: false) # => "1,2,3\n"
//}...

MatchData#to_s -> String (18226.0)

マッチした文字列全体を返します。

...マッチした文字列全体を返します。

//emlist[例][ruby]{
/bar/ =~ "foobarbaz"
p $~ # => #<MatchData:0x401b1be4>
p $~.to_s # => "bar"
//}...
<< 1 2 3 ... > >>