るりまサーチ

最速Rubyリファレンスマニュアル検索!
372件ヒット [301-372件を表示] (0.080秒)
トップページ > クエリ:class[x] > クエリ:inspect[x]

別のキーワード

  1. argf.class each
  2. argf.class each_line
  3. argf.class lines
  4. class new
  5. argf.class gets

検索結果

<< < ... 2 3 4 >>

パターンマッチ (18.0)

パターンマッチ * patterns * variable_binding * variable_pinning * matching_non_primitive_objects * guard_clauses * current_feature_status * pattern_syntax * some_undefined_behavior_examples

...基本的な形はマッチしたパターンの後ろに 『=> 変数名』 と書くことです。(この形は rescue 節で 『rescue ExceptionClass => var』 の形で例外をローカル変数に格納する形に似ています)

//emlist[][ruby]{
case [1, 2]
in Integer => a, Integer
"mat...
...ッチを試みます。

//emlist[][ruby]{
class
Point
def initialize(x, y)
@x, @y = x, y
end

def deconstruct
puts "deconstruct called"
[@x, @y]
end

def deconstruct_keys(keys)
puts "deconstruct_keys called with #{keys.inspect}"
{x: @x, y: @y}
end
end

case Point.ne...
...クラスをパターンの部品として指定することができます。これは 『===』 でチェックされます。

//emlist[][ruby]{
class
SuperPoint < Point
end

case Point.new(1, -2)
in SuperPoint(x: 0.. => px)
"matched: #{px}"
else
"not matched"
end
#=> "not matched"

case Supe...

Module#const_missing(name) (12.0)

定義されていない定数を参照したときに Ruby インタプリタが このメソッドを呼びます。

...mbol

@raise NameError このメソッドを呼び出した場合、デフォルトで発生する例外


//emlist[例][ruby]{
class
Foo
def Foo.const_missing(id)
warn "undefined constant #{id.inspect}"
end

Bar
end
Foo::Bar

# => undefined constant :Bar
# undefined constant :Bar
//}...

NEWS for Ruby 2.5.0 (12.0)

NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...の場合:
//emlist{
{ (method key) => (counter) }
//}
* メソッドキーにはフォーマットがあります:
//emlist{
[class, method-name, start lineno, start column, end lineno, end column]
//}
* 例えば [Object, :foo, 1, 0, 7, 3] は Object#foo は1行目の0桁...
...ps://blog.rubygems.org/2017/08/27/2.6.13-released.html

* securerandom
* SecureRandom.alphanumeric を追加

* set
* Set#to_s を Set#inspect の別名として追加 13676
* Set#=== を Set#include? の別名として追加 13801
* Set#reset 6589

* stringio
* StringIO#wr...

Numeric (12.0)

数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。

...- - - o
infinite? | - - - - o - -
inspect
| - - o o o o o
integer? | o o -...
...d
//}

また、任意桁の切上げ、切捨て、四捨五入を行うメソッドは以下のように
定義できます。

//emlist[][ruby]{
class
Numeric
def roundup(d=0)
x = 10**d
if self > 0
self.quo(x).ceil * x
else
self.quo(x).floor * x
end
end

def roun...
...aginary | o - - - o
infinite? | o - o - o
inspect
| - o o o o
integer? | o o - - -...

Object#pretty_print(pp) -> () (12.0)

PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに 呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。

...オブジェクトです。

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

class
Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
end
//}

@see Object#pretty_print_cycle, Object#inspect, PrettyPrint#text, PrettyPrint#group, PrettyPrint#breakable...
...@param pp PP オブジェクトです。

//emlist[][ruby]{
class
Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
end
//}

@see Object#pretty_print_cycle, Object#inspect, PrettyPrint#text, PrettyPrint#group, PrettyPrint#breakable...

絞り込み条件を変える

WIN32OLE_EVENT#handler=(obj) -> () (12.0)

イベント処理を実行するオブジェクトを登録します。

...j イベントに対応するメソッドを持つオブジェクト。イベント受信を
解除するにはnilを指定します。

class
IeHandler
def initialize
@completed = false
end
attr_reader :completed
def onDocumentComplete(disp, uri)
disp.docume...
...s "#{e.innerHTML}=#{e.href}"
end
@completed = true
end
def method_missing(id, *args)
puts "event=#{id.to_s}, args=#{args.inspect}"
end
end

ie = WIN32OLE.new('InternetExplorer.Application.1')
event = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents2')
event.handler = I...

drb/gw (12.0)

drb 通信を中継するゲートウェイ(DRb::GW)と、 中継に必要なオブジェクト識別子変換クラス(DRb::GWIdConv)、 および DRb::DRbObject への拡張が含まれています。

...まれているものです。

foo.rb
require 'drb/drb'

class
Foo
include DRbUndumped
def initialize(name, peer=nil)
@name = name
@peer = peer
end

def ping(obj)
puts "#{@name}: ping: #{obj.inspect}"
@peer.ping(self) if @peer
end
end

gw_b.rb...
<< < ... 2 3 4 >>