るりまサーチ

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

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. float >
  4. module >
  5. complex >

ライブラリ

クラス

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

DRb::ExtServManager.command -> { String => String|[String] } (201.0)

サービスを起動するためのコマンドを指定するための Hash を 返します。

サービスを起動するためのコマンドを指定するための Hash を
返します。

Hash のキーがサービス名で、値がそのサービスを起動するためのコマンドです。
この Hash を変更することでサービスを定義します。
DRb::ExtServManager.command= で Hash 自体を
変更することでも同じことができます。

コマンドは文字列、もしくは文字列の配列で指定します。
文字列で指定した場合は Kernel.#spawn で
プロセスを起動する際に shell 経由で起動されます。
文字列の配列で指定すると shell を経由せずに起動されます。

GC.stat(result_hash = {}) -> {Symbol => Integer} (201.0)

GC 内部の統計情報を Hash で返します。

....stat
# =>
{
:count=>2,
:heap_used=>9,
:heap_length=>11,
:heap_increment=>2,
:heap_live_slot=>6836,
:heap_free_slot=>519,
:heap_final_slot=>0,
:heap_swept_slot=>818,
:total_allocated_object=>7674,
:total_freed_object=>838,
:malloc_increase=>181034,...
...:malloc_limit=>16777216,
:minor_gc_count=>2,
:major_gc_count=>0,
:remembered_shady_object=>55,
:remembered_shady_object_limit=>0,
:old_object=>2422,
:old_object_limit=>0,
:oldmalloc_increase=>277386,
:oldmalloc_limit=>16777216
}

戻り値のハッシュは処理...
...# =>
{
:count=>0,
:heap_allocated_pages=>24,
:heap_sorted_length=>24,
:heap_allocatable_pages=>0,
:heap_available_slots=>9783,
:heap_live_slots=>7713,
:heap_free_slots=>2070,
:heap_final_slots=>0,
:heap_marked_slots=>0,
:heap_swept_slots=>0,...
...ages=>24,
:heap_tomb_pages=>0,
:total_allocated_pages=>24,
:total_freed_pages=>0,
:total_allocated_objects=>7796,
:total_freed_objects=>83,
:malloc_increase_bytes=>2389312,
:malloc_increase_bytes_limit=>16777216,
:minor_gc_count=>0,
:major_gc_count=>0,...
...:remembered_wb_unprotected_objects=>0,
:remembered_wb_unprotected_objects_limit=>0,
:old_objects=>0,
:old_objects_limit=>0,
:oldmalloc_increase_bytes=>2389760,
:oldmalloc_increase_bytes_limit=>16777216
}

戻り値のハッシュは処理系に依存します。これ...

JSON::Parser.new(source, options => {}) -> JSON::Parser (201.0)

パーサを初期化します。

...uire 'json'

parser = JSON::Parser.new(DATA.read)
print parser.source

# => {
# => "Tanaka": {
# => "name":"tanaka",
# => "age":20
# => },
# => "Suzuki": {
# => "name":"suzuki",
# => "age":25
# => }
# => }

__END__
{
"Tanaka": {
"name":"tanaka",
"age":20
},
"Suz...
...ccessor :name, :age

def []=(key, value)
instance_variable_set("@#{key}", value)
end
end

parser = JSON::Parser.new(DATA.read, object_class: Person)
person = parser.parse
person.class # => Person
person.name # => "tanaka"
person.age # => 20

__END__
{
"name":"tanaka",
"age":20
}
//}...

Struct.new(*args, keyword_init: nil) -> Class (197.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...

//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "name:%s age:%d", fred.name, fred.age
#=> "name:fred age:6" を出力します
//}

実装の都合により、クラス名の省略は後づけの機能でした。
メンバ名に String...
...t1.new(1, 2) # => #<struct Point1 x=1, y=2>
Point1.new(x: 1, y: 2) # => #<struct Point1 x=1, y=2>
Point1.new(x: 1) # => #<struct Point1 x=1, y=nil>
Point1.new(y: 2) # => #<struct Point1 x=nil, y=2>
Point1.new(x: 1, y: 2, z: 3) # => ArgumentError (unknown key...
...t2.new(1, 2) # => #<struct Point2 x=1, y=2>
Point2.new(x: 1, y: 2) # => #<struct Point2 x=1, y=2>
Point2.new(x: 1) # => #<struct Point2 x=1, y=nil>
Point2.new(y: 2) # => #<struct Point2 x=nil, y=2>
Point2.new(x: 1, y: 2, z: 3) # => ArgumentError (unknown key...

Struct.new(*args, keyword_init: nil) {|subclass| block } -> Class (197.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...

//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "name:%s age:%d", fred.name, fred.age
#=> "name:fred age:6" を出力します
//}

実装の都合により、クラス名の省略は後づけの機能でした。
メンバ名に String...
...t1.new(1, 2) # => #<struct Point1 x=1, y=2>
Point1.new(x: 1, y: 2) # => #<struct Point1 x=1, y=2>
Point1.new(x: 1) # => #<struct Point1 x=1, y=nil>
Point1.new(y: 2) # => #<struct Point1 x=nil, y=2>
Point1.new(x: 1, y: 2, z: 3) # => ArgumentError (unknown key...
...t2.new(1, 2) # => #<struct Point2 x=1, y=2>
Point2.new(x: 1, y: 2) # => #<struct Point2 x=1, y=2>
Point2.new(x: 1) # => #<struct Point2 x=1, y=nil>
Point2.new(y: 2) # => #<struct Point2 x=nil, y=2>
Point2.new(x: 1, y: 2, z: 3) # => ArgumentError (unknown key...

絞り込み条件を変える

RubyVM::InstructionSequence.of(body) -> RubyVM::InstructionSequence (179.0)

引数 body で指定した Proc、Method オブジェクトを元に RubyVM::InstructionSequence オブジェクトを作成して返します。

...

# proc
>
p = proc { num = 1 + 2 }
>
RubyVM::InstructionSequence.of(p)
>
# => <RubyVM::InstructionSequence:block in irb_binding@(irb)>

# method
>
def foo(bar); puts bar; end
>
RubyVM::InstructionSequence.of(method(:foo))
>
# => <RubyVM::InstructionSequence:foo@(irb)>

例2: Ruby...
...rb
>
require '/tmp/iseq_of.rb'

# hello メソッド
>
RubyVM::InstructionSequence.of(method(:hello))
>
# => #<RubyVM::InstructionSequence:0x007fb73d7cb1d0>

# グローバル proc
>
RubyVM::InstructionSequence.of($a_global_proc)
>
# => #<RubyVM::InstructionSequence:0x007fb73d7caf78>...
...irb
>
require '/tmp/iseq_of.rb'

# hello メソッド
>
RubyVM::InstructionSequence.of(method(:hello))
>
# => #<RubyVM::InstructionSequence:0x007fb73d7cb1d0>

# グローバル proc
>
RubyVM::InstructionSequence.of($a_global_proc)
>
# => #<RubyVM::InstructionSequence:0x007fb73d7caf78>...

REXML::XPath.first(element, path = nil, namespaces = {}, variables = {}) -> Node | nil (167.0)

element の path で指定した XPath 文字列にマッチする最初のノードを 返します。

...xmlns:x='1'>
<a>
<b>b1</b>
<x:c />
<b>b2</b>
<d />
</a>
<b> b3 </b>
</root>
EOS

a = doc.root.elements[1] # => <a> ... </>
b1 = REXML::XPath.first(a, "b")
b1.text # => "b1"

REXML::XPath.first(doc, "/root/a/x:c") # => <x:c/>
REXML::XPath.first(a, "x:c") # => <x:c/>
REXML::XPat...
...h.first(a, "y:c") # => nil
REXML::XPath.first(a, "y:c", {"y" => "1"}) # => <x:c/>
b2 = REXML::XPath.first(doc, "/root/a/b[text()=$v]", {}, {"v" => "b2"})
b2 # => <b> ... </>
b2.text # => "b2"
//}...

REXML::XPath.match(element, path = nil, namespaces = {}, variables = {}) -> [Node] (167.0)

element の path で指定した XPath 文字列にマッチするノードの配列を 返します。

...s 変数名とその値の対応付け

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:x='1'>
<a>
<b>b1</b>
<x:c />
<b>b2</b>
<d />
</a>
<b> b3 </b>
</root>
EOS

REXML::XPath.match(doc, "/root/a/b") # => [<b> ... </>, <b> ... </>]
//}...

ThreadsWait.all_waits(*threads) -> () (161.0)

指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。

...> #<Thread:0x21584 run>
#=> #<Thread:0x21610 run>
#=> #<Thread:0x2169c run>
#=> #<Thread:0x21728 run>
#=> #<Thread:0x214f8 run>
#=> end #<Thread:0x21584 dead>
#=> end #<Thread:0x21610 dead>
#=> end #<Thread:0x2169c dead>
#=> end #<Thread:0x21728 dead>
#=> end #<Thread:0x214f8 dead>...

ThreadsWait.all_waits(*threads) {|thread| ...} -> () (161.0)

指定されたスレッドすべてが終了するまで待ちます。 ブロックが与えられた場合、スレッド終了時にブロックを評価します。

...> #<Thread:0x21584 run>
#=> #<Thread:0x21610 run>
#=> #<Thread:0x2169c run>
#=> #<Thread:0x21728 run>
#=> #<Thread:0x214f8 run>
#=> end #<Thread:0x21584 dead>
#=> end #<Thread:0x21610 dead>
#=> end #<Thread:0x2169c dead>
#=> end #<Thread:0x21728 dead>
#=> end #<Thread:0x214f8 dead>...

絞り込み条件を変える

ThreadsWait.new(*threads) -> ThreadsWait (161.0)

指定されたスレッドの終了をまつための、スレッド同期オブジェクトをつくります。

...> #<Thread:0x214bc run>
#=> #<Thread:0x21548 run>
#=> #<Thread:0x215d4 run>
#=> #<Thread:0x21660 run>
#=> #<Thread:0x21430 run>
#=> end #<Thread:0x214bc dead>
#=> end #<Thread:0x21548 dead>
#=> end #<Thread:0x215d4 dead>
#=> end #<Thread:0x21660 dead>
#=> end #<Thread:0x21430 dead>...

REXML::XPath.each(element, path = nil, namespaces = {}, variables = {}) {|e| ... } -> () (155.0)

element の path で指定した XPath 文字列にマッチする各ノード に対してブロックを呼び出します。

...変数名とその値の対応付け

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:x='1'>
<a>
<b>b1</b>
<x:c />
<b>b2</b>
<d />
</a>
<b> b3 </b>
</root>
EOS

REXML::XPath.each(doc, "/root/a/b"){|e| p e.text }
# >> "b1"
# >> "b2"
//}...

CGI.pretty(string, shift = " ") -> String (149.0)

HTML を人間に見やすく整形した文字列を返します。

...cgi"

print CGI.pretty("<HTML><BODY></BODY></HTML>")
# <HTML>
# <BODY>
# </BODY>
# </HTML>

print CGI.pretty("<HTML><BODY></BODY></HTML>", "\t")
# <HTML>
# <BODY>
# </BODY>
# </HTML>...
<< 1 2 3 ... > >>