るりまサーチ

最速Rubyリファレンスマニュアル検索!
66件ヒット [1-66件を表示] (0.032秒)
トップページ > クエリ:|[x] > クエリ:instance_method[x]

別のキーワード

  1. csv instance
  2. prime instance
  3. syslog instance
  4. _builtin instance_eval
  5. singleton instance

ライブラリ

クラス

検索結果

Module#instance_method(name) -> UnboundMethod (18137.0)

self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。

...#public_instance_method, Object#method

//emlist[例][ruby]{
class Interpreter
def do_a() print "there, "; end
def do_d() print "Hello "; end
def do_e() print "!\n"; end
def do_v() print "Dave"; end
Dispatcher = {
"a" => instance_method(:do_a),
"d" => instance_method(:do_d)...
...,
"e" => instance_method(:do_e),
"v" => instance_method(:do_v)
}
def interpret(string)
string.each_char {|b| Dispatcher[b].bind(self).call }
end
end

interpreter = Interpreter.new
interpreter.interpret('dave')
# => Hello there, Dave!
//}...

ruby 1.6 feature (120.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...ruby 1.6 feature
ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン
になります。

((<stable-snapshot|URL:ftp://ftp.netlab.co.jp/pub/lang/ruby/stable-snapshot.tar.gz>)) は、日々更新される安定版の最新ソースです。

== 1.6.8 (2002-12-24) ->...
...05-20 IO#close

双方向のパイプの dup を close_write するとエラーになっていました。
((<ruby-dev:17155>))

open("|-","r+") {|f|
if f
f.dup.close_write
else
sleep 1
end
}

=> ruby 1.6.7 (2002-03-01) [i586-linux]
-:3:in `c...
...egmentation Fault していました。((<ruby-dev:14942>))

Module.constants.each {|c|
c = eval c
if c.instance_of?(Class)
p c
c.instance_methods.each {|m|
c.module_eval "undef #{m};"
}
c.module_eval {undef in...

UnboundMethod#owner -> Class | Module (119.0)

このメソッドが定義されている class か module を返します。

...このメソッドが定義されている class か module を返します。

//emlist[例][ruby]{
Integer.instance_method(:to_s).owner # => Integer
Integer.instance_method(:to_c).owner # => Numeric
Integer.instance_method(:hash).owner # => Kernel
//}...

UnboundMethod#source_location -> [String, Integer] | nil (113.0)

ソースコードのファイル名と行番号を配列で返します。

...(つまりネイティブ
である)場合は nil を返します。

//emlist[例][ruby]{
require 'time'

Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2.4.0/time.rb", 654]
//}

@see Pro...

NEWS for Ruby 2.7.0 (84.0)

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

...by 3.0 では verbose モードでなくても表示され、Ruby 3.2 で削除される
予定です。 16131

* Object#methodとModule#instance_methodがrefinementsを考慮するようになりました。 15373

=== コマンドラインオプション

==== 警告オプション

カテ...
...加されました。 15323
* Enumerable#tallyが追加されました。 11076
//emlist[Enumerable#filter_map][ruby]{
[1, 2, 3].filter_map {|x| x.odd? ? x.to_s : nil } #=> ["1", "3"]
//}
//emlist[Enumerable#tally][ruby]{
["A", "B", "C", "B", "A"].tally #=> {"A"=>2, "B"=>2, "C"=>1}
//}

* En...
...{
a = %w(foo bar baz)
e = a.lazy.map {|x| x.upcase }.map {|x| x + "!" }.eager
p e.class #=> Enumerator
p e.map {|x| x + "?" } #=> ["FOO!?", "BAR!?", "BAZ!?"]
//}
//emlist[Enumerator::Lazy#with_index][ruby]{
("a"..).lazy.with_index(1) { |it, index| puts "#{index}:#{it}" }.take(3).force...

絞り込み条件を変える

ruby 1.8.4 feature (24.0)

ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。

...def initialize
super
end
end

class Bar
include Foo
def initialize
Foo.instance_method(:initialize).bind(self).call
end
end

Bar.new

# => ruby 1.8.3 (2005-09-21) [i686-linux]
-:3:i...
...切り捨てられていたバグの修正。

require "optparse"

puts "[#{ARGV * ', '}]"
ARGV.options do |opt|
opt.on("-n NODE") {|v| puts v }
opt.parse!
end

>ruby -v -Ku a.rb -n 時間
ruby 1.8.2 (2004-12-25) [i386-mswin32]...