るりまサーチ

最速Rubyリファレンスマニュアル検索!
257件ヒット [1-100件を表示] (0.071秒)
トップページ > クエリ:new[x] > クエリ:to_s[x] > クエリ:|[x] > 種類:インスタンスメソッド[x]

別のキーワード

  1. _builtin to_s
  2. openssl to_der
  3. openssl to_s
  4. _builtin to_a
  5. openssl to_pem

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 > >>

Shell::Filter#|(filter) -> object (18137.0)

パイプ結合を filter に対して行います。

...ll.def_system_command("tail")
Shell.def_system_command("head")
Shell.def_system_command("wc")
sh = Shell.new
sh.transact {
i = 1
while i <= (cat("/etc/passwd") | wc("-l")).to_s.chomp.to_i
puts (cat("/etc/passwd") | head("-n #{i}") | tail("-n 1")).to_s
i += 1
end
}...

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

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

...mlist[例][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>'
//}...

Shell::Filter#to_s -> String (18120.0)

実行結果を文字列で返します。

...実行結果を文字列で返します。

require 'shell'
Shell.def_system_command("wc")
sh = Shell.new

sh.transact {
puts (cat("/etc/passwd") | wc("-l")).to_s
}...

Module#to_s -> String (15139.0)

モジュールやクラスの名前を文字列で返します。

...lass C
end
end

p A.name #=> "A"
p A::B.name #=> "A::B"
p A::C.name #=> "A::C"

# 名前のないモジュール / クラス
p Module.new.name #=> nil
p Class.new.name #=> nil
p Module.new.to_s #=> "#<Module:0x00007f90b09112c8>"
p Class.new.to_s #=> "#<Class:0x00007fa5c40b41b0>"
//}...

OptionParser#to_s -> String (15132.0)

サマリの文字列を返します。

...返します。

//emlist[例][ruby]{
require "optparse"

options = {}
opts = OptionParser.new do |opts|
opts.banner = "Usage: example.rb [options]"

opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
options[:verbose] = v
end
end

puts opts.help

# => Usage: example.rb [options]
#...

絞り込み条件を変える

WIN32OLE_VARIABLE#to_s -> String (15120.0)

変数名を取得します。

...変数名を取得します。

@return 変数名を文字列で返します。

tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
puts "#{variable.name}" # => xlChart, xlDialogSheet, ...
end...

CSV::Row#to_s -> String (15114.0)

自身を CSV な文字列として返します。ヘッダは使用しません。

...自身を CSV な文字列として返します。ヘッダは使用しません。

//emlist[例][ruby]{
require "csv"

row = CSV::Row.new(["header1", "header2"], [1, 2])
row.to_csv # => "1,2\n"
row.to_csv( {col_sep: "|", row_sep: "<br>"} ) # => "1|2<br>"
//}...

Enumerable#to_set(klass = Set, *args) {|o| ... } -> Set (6226.0)

Enumerable オブジェクトの要素から、新しい集合オブジェクトを作ります。

...ラスメソッドで互換性のあるクラスです)。
引数 args およびブロックは、集合オブジェクトを生成するための new
メソッドに渡されます。


@param klass 生成する集合クラスを指定します。
@param args 集合クラスのオブジェクト初...
.../emlist[][ruby]{
require 'set'
p [30, 10, 20].to_set
#=> #<Set: {30, 10, 20}>
p [30, 10, 20].to_set(SortedSet)
#=> #<SortedSet: {10, 20, 30}>
MySet = Class.new(Set)
p [30, 10, 20].to_set(MySet)
#=> #<MySet: {10, 20, 30}>
p [30, 10, 20].to_set {|num| num / 10}
#=> #<Set: {3, 1, 2}>
//}

@see Set.new...
...y 2.7 以前は SortedSet が定義されていました)。
引数 args およびブロックは、集合オブジェクトを生成するための new
メソッドに渡されます。


@param klass 生成する集合クラスを指定します。
@param args 集合クラスのオブジェクト...
...urn 生成された集合オブジェクトを返します。

//emlist[][ruby]{
require 'set'
p [30, 10, 20].to_set
#=> #<Set: {30, 10, 20}>
MySet = Class.new(Set)
p [30, 10, 20].to_set(MySet)
#=> #<MySet: {10, 20, 30}>
p [30, 10, 20].to_set {|num| num / 10}
#=> #<Set: {3, 1, 2}>
//}

@see Set.new...

Enumerable#to_set(klass = Set, *args) -> Set (6126.0)

Enumerable オブジェクトの要素から、新しい集合オブジェクトを作ります。

...ラスメソッドで互換性のあるクラスです)。
引数 args およびブロックは、集合オブジェクトを生成するための new
メソッドに渡されます。


@param klass 生成する集合クラスを指定します。
@param args 集合クラスのオブジェクト初...
.../emlist[][ruby]{
require 'set'
p [30, 10, 20].to_set
#=> #<Set: {30, 10, 20}>
p [30, 10, 20].to_set(SortedSet)
#=> #<SortedSet: {10, 20, 30}>
MySet = Class.new(Set)
p [30, 10, 20].to_set(MySet)
#=> #<MySet: {10, 20, 30}>
p [30, 10, 20].to_set {|num| num / 10}
#=> #<Set: {3, 1, 2}>
//}

@see Set.new...
...y 2.7 以前は SortedSet が定義されていました)。
引数 args およびブロックは、集合オブジェクトを生成するための new
メソッドに渡されます。


@param klass 生成する集合クラスを指定します。
@param args 集合クラスのオブジェクト...
...urn 生成された集合オブジェクトを返します。

//emlist[][ruby]{
require 'set'
p [30, 10, 20].to_set
#=> #<Set: {30, 10, 20}>
MySet = Class.new(Set)
p [30, 10, 20].to_set(MySet)
#=> #<MySet: {10, 20, 30}>
p [30, 10, 20].to_set {|num| num / 10}
#=> #<Set: {3, 1, 2}>
//}

@see Set.new...

Pathname#each_entry {|pathname| ... } -> nil (156.0)

Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。

...Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。


//emlist[例][ruby]{
require "pathname"

Pathname("/usr/local").each_entry {|f| p f }

# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathna...
...Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。

ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
require "pathname"

Pathname("/usr/local").each_entry {|f| p f }

# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathna...

絞り込み条件を変える

<< 1 2 3 > >>