キーワード
- === (7)
-
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) - OCSP (12)
- SSLServer (12)
-
_ getproperty (12) -
_ setproperty (12) -
bigdecimal
/ math (12) - drb (12)
-
drb
/ extservm (12) -
drb
/ gw (12) - h (12)
-
html
_ escape (12) -
respond
_ to? (12) -
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 4 feature (12) -
try
_ cpp (24) - u (12)
-
url
_ encode (12) - クラス/メソッドの定義 (12)
- 変数と定数 (12)
検索結果
先頭5件
-
Object
# respond _ to?(name , include _ all = false) -> bool (161.0) -
オブジェクトがメソッド name を持つとき真を返します。
...o_missing? を呼
び出してその結果を返します。
@param name Symbol または文字列で指定するメソッド名です。
@param include_all private メソッドと protected メソッドを確認の対象に
含めるかを true か false で指定します。......D.new]
list.each{|it| puts it.hello if it.respond_to?(:hello)}
#=> Bonjour
list.each{|it| it.instance_eval("puts hello if it.respond_to?(:hello, true)")}
#=> Bonjour
# Guten Tag
module Template
def main
start
template_method
finish
end
def start
puts "start"
end
def......mentedError.new
end
def finish
puts "finish"
end
end
class ImplTemplateMethod
include Template
def template_method
"implement template_method"
end
end
class NotImplTemplateMethod
include Template
# not implement template_method
end
puts ImplTemplateMethod.new.respond_to?... -
クラス/メソッドの定義 (126.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...い。Net を include できるなどのため)
module Net
class HTTP
end
class FTP
end
end
obj = Net::HTTP.new
# あるいは
include Net
obj = HTTP.new
# 以下のような使い方は組み込みのクラスにも見られる
# 利用者は File::Constants を include することで......直接 RDONLY と書くことができる。
class File
module Constants
RDONLY = 0
WRONLY = 1
end
include Constants
end
File.open("foo", File::RDONLY)
# あるいは
include File::Constants
File.open("foo", RDONLY)
# 上記はあくまでも例である。実際の File.open で......結果
として他の言語における「関数」のように使えます。
//emlist[例][ruby]{
def hello # 引数のないメソッド。
puts "Hello, world!"
end
def foo(a, b) # 引数のあるメソッド。括弧を省いてdef foo a, bとも
a + 3 * b
end
//}
メソッド名... -
ruby 1
. 6 feature (120.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...シグナルを送らないと終了しない不具合が修正さ
れました。((<ruby-bugs-ja:PR#223>))
trap(:TERM, "EXIT")
END{
puts "exit"
}
Thread.start { Thread.stop }
sleep
: 2002-04-17: Regexp#inspect
((<ruby-bugs-ja:PR#222>))
p %r{\/}
=> ruby 1......18>)), ((<ruby-dev:15684>)),
((<ruby-dev:15757>))
: ((<Module/include>))
モジュールが再帰的に include されないようになりました。
module Foo; end
module Bar; include Foo; end
module Foo; include Bar; end
p Foo.ancestors
=> ruby 1.6.6 (2001-12-26) [i......586-linux]
[Foo, Bar, Foo]
=> -:3:in `append_features': cyclic include detected (ArgumentError)
from -:3:in `include'
from -:3
ruby 1.6.6 (2002-01-28) [i586-linux]
: メソッドの戻り値
以下のメソッドの戻り値が正しくなりました... -
ruby 1
. 8 . 4 feature (78.0) -
ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。
...ns invalid symbol representations:
puts :"!".inspect
puts :"=".inspect
puts :"0".inspect
puts :"$1".inspect
puts :"@1".inspect
puts :"@@1".inspect
puts :"@".inspect
puts :"@@".inspect
# => r......"
:"@"
:"@@"
3) Symbol#inspect sometimes returns suboptimal symbol representations:
puts :foo!.inspect
puts :bar?.inspect
# => ruby 1.8.3 (2005-09-21) [i686-linux]
:"foo!"
:"bar?"......ました。((<ruby-dev:27964>))
module Foo
def initialize
super
end
end
class Bar
include Foo
def initialize
Foo.instance_method(:initialize).bind(self).call
end
end
Bar.new... -
OpenSSL
:: OCSP (54.0) -
OCSP(Online Certificate Status Protocol)を取り扱うための モジュールです。OCSP は 2560 で定義されています。
....new(httpres.body)
puts "Response status: #{res.status_string}"
exit if res.status != OpenSSL::OCSP::RESPONSE_STATUS_SUCCESSFUL
basic_resp = res.basic
raise "nonce error" unless [-1, 1].include?(req.check_nonce(basic_resp))
unless basic_resp.verify([], store)
puts "verify response......,
}
puts "status: #{STATUS2MESSAGE[status]}"
puts "reason: #{reason}" if status == OpenSSL::OCSP::V_CERTSTATUS_REVOKED
puts "revoked time: #{revtime}" if status == OpenSSL::OCSP::V_CERTSTATUS_REVOKED
puts "response update: #{thisupd}"
puts "response next update: #{nextupd}"
puts "exte... -
Range
# ===(obj) -> bool (54.0) -
始端と終端の中に obj があるとき、true を返します。 そうでないとき、false を返します。
...0...50) === 79 #=> false
p (60...80) === 79 #=> true
case 79
when 0...60 then puts "low"
when 60...80 then puts "medium" # => medium
when 80..100 then puts "high"
end
//}
2.5 以前は、単純に Range#include? メソッドを内部で呼んでいました。
しかし、2.6 以降では......e'
p (Date.today - 100...Date.today + 100).include?(DateTime.now) #=> false
p (Date.today - 100...Date.today + 100).cover?(DateTime.now) #=> true
p (Date.today - 100...Date.today + 100) === DateTime.now #=> true
# 2.5 以前は、=== は、include? と同じく比較できず false を返......していました。
//}
@see d:spec/control#case
@see Range#include?, Range#cover?......//emlist[例][ruby]{
p ('a'..'z').include? 'at' #=> false
p ('a'..'z').cover? 'at' #=> true
p ('a'..'z') === 'at' #=> true
# 2.6 以前は、=== は、include? と同じく比較できず false を返していました。
//}
@see d:spec/control#case
@see Range#include?, Range#cover?... -
NEWS for Ruby 2
. 7 . 0 (30.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...しでProc.newやKernel#procを
呼び出すと警告が表示されるようになりました。
//emlist[][ruby]{
def foo
proc
end
foo { puts "Hello" } #=> warning: Capturing the given block using Kernel#proc is deprecated; use `&block` instead
//}
* 非推奨に関する警告を止め......nel#lambdaをブロックなしで呼び出すと
例外が発生するようになりました。
//emlist[][ruby]{
def bar
lambda
end
bar { puts "Hello" } #=> tried to create Proc object without a block (ArgumentError)
//}
==== その他の変更
* 始端なしRangeが実験的に導入......Range#===がString引数に対してもRange#cover?を使うようになりました。
(Ruby 2.6ではString以外の全ての型でRange#include?から変更されていました。)
15449
* RubyVM
* 削除されたメソッド
* RubyVM.resolve_feature_pathが$LOAD_PAT... -
NEWS for Ruby 3
. 0 . 0 (30.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...IO
* IO#nonblock? now defaults to `true`. 16786
* IO#wait_readable, IO#wait_writable, IO#read, IO#write and other related methods (e.g. IO#puts, IO#gets) may invoke the scheduler hook `#io_wait(io, events, timeout)` in a non-blocking execution context. 16786
* Kernel
* Kernel#clone wh......ntext. 16786
* Module
* Module#include and Module#prepend now affect classes and modules that have already included or prepended the receiver, mirroring the behavior if the arguments were included in the receiver before the other modules and classes included or prepended the receiver. 9573......* Module#alias_method now returns the defined alias as a symbol. 17314
//emlist[][ruby]{
class C; end
module M1; end
module M2; end
C.include M1
M1.include M2
p C.ancestors #=> [C, M1, M2, Object, Kernel, BasicObject]
//}
* Mutex
* `Mutex` is now acquired per-`Fiber` instead of per-`Thr... -
NEWS for Ruby 3
. 1 . 0 (24.0) -
NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...92
* 1行のメソッド定義が括弧なしで書けるようになりました。例として def foo = puts "Hello" と記述できるようになりました。 private def foo = puts "Hello" はパースされないことに注意してください。 17398
== コマンドラインオプ......protected? が追加されました。 11689
* Module
* 変更されたメソッド
* Module#prepend はレシーバが既に引数をincludeしている場合、継承ツリーを変更するようになりました。レシーバが既に引数をprependしている場合、継承ツ......pthread実装に置き換えました。 18015
* Refinement
* Module#refineで作成されたモジュールを表す新しいクラス。includeとprependは非推奨になり、代わりにimport_methodsが追加されました。
== 標準添付ライブラリの更新(機能追加とバ... -
WIN32OLE
# _ getproperty(dispid , args , types) -> object (18.0) -
DISPIDとパラメータの型を指定してオブジェクトのプロパティを参照します。
...理由はメッセージのHRESULTを調べてください。
DISPID_CELLS = 238
include WIN32OLE::VARIANT
excel = WIN32OLE.new('Excel.Application')
puts excel._getproperty(558, [], []) # VisibleプロパティのDISPIDは558
workbook = excel.Workbooks.Add......sheet = workbook.Worksheets[1]
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から取得でき... -
WIN32OLE
# _ setproperty(dispid , args , types) -> () (18.0) -
DISPIDとパラメータの型を指定してオブジェクトのプロパティを設定します。
...理由はメッセージのHRESULTを調べてください。
DISPID_CELLS = 238
include WIN32OLE::VARIANT
excel = WIN32OLE.new('Excel.Application')
puts excel._setproperty(558, # VisibleプロパティのDISPIDは558
[true], [VT_B......workbook = excel.Workbooks.Add
sheet = workbook.Worksheets[1]
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はWIN3...