別のキーワード
ライブラリ
- ビルトイン (745)
- delegate (48)
- erb (12)
-
irb
/ output-method (36) - json (60)
-
minitest
/ spec (1) -
minitest
/ unit (1) - psych (8)
-
rdoc
/ code _ object (12) - win32ole (348)
クラス
- Array (10)
- BasicObject (72)
- Delegator (48)
- ERB (12)
- Enumerator (48)
-
Enumerator
:: Lazy (48) -
IRB
:: OutputMethod (36) -
JSON
:: State (24) - Method (92)
- Module (152)
- NameError (24)
- NoMethodError (12)
- Object (217)
- Proc (12)
-
RDoc
:: CodeObject (12) - Regexp (24)
- Thread (12)
- TracePoint (7)
- UnboundMethod (24)
- WIN32OLE (36)
-
WIN32OLE
_ METHOD (204) -
WIN32OLE
_ PARAM (84) -
WIN32OLE
_ TYPE (24)
モジュール
キーワード
- === (8)
- [] (36)
-
_ getproperty (12) -
_ invoke (12) - args (12)
-
assert
_ respond _ to (1) -
bind
_ call (12) - call (24)
-
class
_ exec (12) -
def
_ class (12) - default (12)
-
default
_ event _ sources (12) -
define
_ singleton _ method (24) - dig (10)
- dispid (12)
- each (48)
-
enum
_ for (48) - event? (12)
-
event
_ interface (12) - generate (12)
- helpcontext (12)
- input? (12)
- inspect (12)
-
instance
_ eval (24) -
instance
_ method (12) -
instance
_ methods (12) - invkind (12)
-
invoke
_ kind (12) - match (24)
- method (12)
-
method
_ missing (36) - methods (24)
-
module
_ exec (12) -
must
_ respond _ to (1) - name (36)
-
offset
_ vtbl (12) -
ole
_ methods (12) -
ole
_ type (12) -
ole
_ type _ detail (12) - optional? (12)
- parameters (43)
- params (12)
- pp (12)
- ppx (12)
-
private
_ instance _ methods (12) -
private
_ methods (12) -
protected
_ instance _ methods (12) -
protected
_ methods (24) -
psych
_ yaml _ as (4) - public (48)
-
public
_ instance _ method (12) -
public
_ instance _ methods (12) -
public
_ method (12) -
public
_ methods (24) - puts (12)
- receiver (12)
-
remove
_ methods _ etc (12) -
respond
_ to? (12) -
respond
_ to _ missing? (12) -
return
_ type (12) -
return
_ type _ detail (12) -
return
_ vtype (12) -
singleton
_ method (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12) -
singleton
_ methods (12) -
size
_ opt _ params (12) -
size
_ params (12) -
to
_ enum (48) -
to
_ json (12) -
to
_ json _ raw (12) -
to
_ json _ raw _ object (12) -
to
_ s (48) - visible? (12)
-
yaml
_ as (4)
検索結果
先頭5件
-
Module
# module _ exec(*args) {|*vars| . . . } -> object (109.0) -
与えられたブロックを指定された args を引数としてモジュールのコンテキストで評価します。
...す引数を指定します。
//emlist[例][ruby]{
class Thing
end
c = 1
Thing.class_exec{
def hello()
"Hello there!"
end
define_method(:foo) do # ローカル変数がブロックの外側を参照している
c
end
}
t = Thing.new
p t.hello() #=> "Hello there!"... -
Array
# dig(idx , . . . ) -> object | nil (108.0) -
self 以下のネストしたオブジェクトを dig メソッドで再帰的に参照して返し ます。途中のオブジェクトが nil であった場合は nil を返します。
...ます。
//emlist[例][ruby]{
a = [[1, [2, 3]]]
a.dig(0, 1, 1) # => 3
a.dig(1, 2, 3) # => nil
a.dig(0, 0, 0) # => TypeError: Fixnum does not have #dig method
[42, {foo: :bar}].dig(1, :foo) # => :bar
//}
@see Hash#dig, Struct#dig, OpenStruct#dig......ます。
//emlist[例][ruby]{
a = [[1, [2, 3]]]
a.dig(0, 1, 1) # => 3
a.dig(1, 2, 3) # => nil
a.dig(0, 0, 0) # => TypeError: Integer does not have #dig method
[42, {foo: :bar}].dig(1, :foo) # => :bar
//}
@see Hash#dig, Struct#dig, OpenStruct#dig... -
Proc
# parameters -> [object] (108.0) -
Proc オブジェクトの引数の情報を返します。
...ck
& で指定されたブロック引数
//emlist[例][ruby]{
prc = lambda{|x, y=42, *other, k_x:, k_y: 42, **k_other, &b|}
prc.parameters #=> x], [:opt, :y], [:rest, :other], [:keyreq, :k_x], [:key, :k_y], [:keyrest, :k_other], [:block, :b
//}
@see Method#parameters, UnboundMethod#parameters... -
Proc
# parameters(lambda: nil) -> [object] (108.0) -
Proc オブジェクトの引数の情報を返します。
...parameters # => x], [:opt, :y], [:rest, :other
prc = proc{|x, y=42, *other|}
p prc.parameters(lambda: true) # => x], [:opt, :y], [:rest, :other
prc = lambda{|x, y=42, *other|}
p prc.parameters(lambda: false) # => x], [:opt, :y], [:rest, :other
//}
@see Method#parameters, UnboundMethod#parameters... -
Regexp
# match(str , pos = 0) {|m| . . . } -> object | nil (108.0) -
指定された文字列 str に対して位置 pos から自身が表す正規表現によるマッ チングを行います。マッチした場合には結果を MatchData オブジェクトで返し ます。 マッチしなかった場合 nil を返します。
...s では、マッチに失敗した場合、
nil.captures を呼び出そうとして例外 NoMethodError が発生して
しまいます。
//emlist[例][ruby]{
foo, bar, baz = /(foo)(bar)(baz)/.match("foobar").captures
# => -:1: undefined method `captures' for nil:NilClass (NoMethodError)
//}......に失敗した場合、
nil.captures を呼び出そうとして例外 NoMethodError が発生して
しまいます。
//emlist[例][ruby]{
foo, bar, baz = /(foo)(bar)(baz)/.match("foobar").captures
# => -:1: undefined method `captures' for nil:NilClass (NoMethodError)
//}
@see Regexp#match?... -
Thread
# [](name) -> object | nil (108.0) -
name に対応したスレッドに固有のデータを取り出します。 name に対応するスレッド固有データがなければ nil を返し ます。
...}
meth(2) {
f.resume
}
f.resume
p Thread.current[:name]
# => nil if fiber-local
# => 2 if thread-local (The value 2 is leaked to outside of meth method.)
//}
Fiber を切り替えても同じ変数を返したい場合は
Thread#thread_variable_get と Thread#thread_variable_set
を使用して... -
WIN32OLE
# _ getproperty(dispid , args , types) -> object (108.0) -
DISPIDとパラメータの型を指定してオブジェクトのプロパティを参照します。
...sheet._setproperty(DISPID_CELLS, [1, 2, 'hello'], [VT_I2, VT_I2, VT_BSTR])
puts sheet._getproperty(DISPID_CELLS, [1, 2], [VT_I2, VT_I2]).value #=> 'hello'
workbook.Close(:SaveChanges => false)
excel.Quit
DISPIDはWIN32OLE_METHOD#dispidから取得できます。
@see WIN32OLE::VARIANT... -
JSON
:: State # generate(obj) -> String (33.0) -
Generates a valid JSON document from object obj and returns the result. If no valid JSON document can be created this method raises a GeneratorError exception.
...Generates a valid JSON document from object obj and returns the
result. If no valid JSON document can be created this method raises a
GeneratorError exception.... -
Enumerator
# each -> self (27.0) -
生成時のパラメータに従ってブロックを繰り返します。 *args を渡した場合は、生成時のパラメータ内引数末尾へ *args を追加した状態で繰り返します。 ブロック付きで呼び出された場合は、 生成時に指定したイテレータの戻り値をそのまま返します。
...rld"]
obj = Object.new
def obj.each_arg(a, b=:b, *rest)
yield a
yield b
yield rest
:method_returned
end
enum = obj.to_enum :each_arg, :a, :x
enum.each.to_a # => [:a, :x, []]
enum.each.equal?(enum) # => true
enum.each { |elm| elm } # => :method_returned......enum.each(:y, :z).to_a # => [:a, :x, [:y, :z]]
enum.each(:y, :z).equal?(enum) # => false
enum.each(:y, :z) { |elm| elm } # => :method_returned
//}... -
Enumerator
# each(*args) -> Enumerator (27.0) -
生成時のパラメータに従ってブロックを繰り返します。 *args を渡した場合は、生成時のパラメータ内引数末尾へ *args を追加した状態で繰り返します。 ブロック付きで呼び出された場合は、 生成時に指定したイテレータの戻り値をそのまま返します。
...rld"]
obj = Object.new
def obj.each_arg(a, b=:b, *rest)
yield a
yield b
yield rest
:method_returned
end
enum = obj.to_enum :each_arg, :a, :x
enum.each.to_a # => [:a, :x, []]
enum.each.equal?(enum) # => true
enum.each { |elm| elm } # => :method_returned......enum.each(:y, :z).to_a # => [:a, :x, [:y, :z]]
enum.each(:y, :z).equal?(enum) # => false
enum.each(:y, :z) { |elm| elm } # => :method_returned
//}... -
NameError
# to _ s -> String (25.0) -
例外オブジェクトを文字列に変換して返します。
...オブジェクトを文字列に変換して返します。
例:
begin
foobar
rescue NameError => err
p err # => #<NameError: undefined local variable or method `foobar' for main:Object>
p err.to_s # => "undefined local variable or method `foobar' for main:Object"
end...