種類
- インスタンスメソッド (257)
- 文書 (51)
- ライブラリ (44)
- クラス (33)
- 特異メソッド (11)
ライブラリ
- ビルトイン (99)
- csv (22)
- fiddle (11)
- optparse (22)
- ostruct (12)
- pathname (35)
-
rexml
/ document (11) - set (22)
-
shell
/ filter (12) -
webrick
/ httpresponse (22) - win32ole (33)
クラス
-
CSV
:: Row (22) - Module (33)
- OpenStruct (12)
- OptionParser (22)
- Pathname (35)
- Range (11)
-
Shell
:: Filter (12) - Thread (22)
-
Thread
:: Backtrace :: Location (22) -
WEBrick
:: HTTPResponse (22) -
WIN32OLE
_ EVENT (11) -
WIN32OLE
_ VARIABLE (22)
モジュール
- Enumerable (22)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - BlockCaller (11)
- ExternalEntity (11)
- Location (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) -
add
_ trace _ func (11) -
content
_ length (11) -
content
_ length= (11) -
each
_ entry (13) - find (22)
- handler= (11)
- help (11)
- inspect (22)
- irb (11)
- name (22)
-
optparse
/ date (11) - resolv (11)
- rss (11)
-
ruby 1
. 6 feature (11) -
set
_ trace _ func (11) -
to
_ csv (11) -
to
_ h (12) -
to
_ set (22) - メソッド呼び出し(super・ブロック付き・yield) (9)
検索結果
先頭5件
-
NEWS for Ruby 2
. 7 . 0 (26156.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 2.7.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......Numbered parameters)がデフォルトのブロックの仮引数として
導入されました。 4475
//emlist[][ruby]{
[1, 2, 10].map { _1.to_s(16) } #=> ["1", "2", "a"]
[[1, 2], [3, 4]].map { _1 + _2 } #=> [3, 7]
//}
* 「_1」などはまだローカル変数名として使えて......れました。 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}
//}
* Enumerat... -
NEWS for Ruby 2
. 0 . 0 (26084.0) -
NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 2.0.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......たときの名前ではなく呼び出したときの名前を返します。
* 非互換: Object#inspect は #to_s を呼び出さなくなりました。再定義された #to_s を呼び出すためです。
* LoadError
* 追加: LoadError#path ロードできなかったファイル......性のためまだサポートしています。
//emlist{
str.lines.with_index(1) {|line, lineno| ... } # str.lines が配列を返すのでもう動かない
str.each_line.with_index(1) {|line, lineno| ... } # このように each_line に置き換える
//}
* IO#lines, IO#chars, IO#cod... -
NEWS for Ruby 3
. 0 . 0 (26072.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 3.0.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......osplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166
//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}
pr.call([1])
# 2.7 => [[1], {}]
# 3.0 => [[[1]], {}]
pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 =>......tinuously improve the coverage of language features, analysis performance, and usability.
//emlist[][ruby]{
# test.rb
def foo(x)
if x > 10
x.to_s
else
nil
end
end
foo(42)
//}
//emlist{
$ typeprof test.rb
# Classes
class Object
def foo : (Integer) -> String?
end
//}
== Miscellaneo... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (25910.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...スのスーパークラスは同じなのだそうです
((<ruby-bugs-ja:324>))。さあっぱりわかりません(^^;;
class << Object.new
class << self.superclass
p [self.id, self]
end
class << self
p [self.superclass.id, self.supe......のように変更されました。((<ruby-dev:20358>))
* Proc.new およびブロック引数で与えられる Proc は
引数チェックがゆるい。break が例外になる。
Proc.new {|a,b,c| p [a,b,c]}.call(1,2)
=> -:1: wrong # of arguments (2 f......yield の戻り値になります。
: to_str [compat]
to_str を定義したオブジェクトはより広範囲にStringとして振舞うように
なりました。
文字列を引数に取るほとんどの組み込みメソッドは、to_str による暗黙の
型変換を試... -
ruby 1
. 6 feature (23390.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) ->......00019>))
: 2002-09-11: Queue#((<Queue/pop>))
Queue#pop に競合状態の問題がありました ((<ruby-dev:17223>))
: 2002-09-11: SizedQueue.new
引数に 0 以下を受けつけるバグが修正されました。
: 2002-09-05: ((<リテラル/式展開>))
stable snapshot で、一......効きます(つまり、名前解
決中にThreadが切替え可能ということです)
require 'resolv'
p Resolv.new.getaddress("www.ruby-lang.org").to_s
=> /usr/local/lib/ruby/1.6/resolv.rb:160: warning: timeout (...) interpreted as method call
/usr/local/lib/ruby/1.6/res... -
Range
. new(first , last , exclude _ end = false) -> Range (18197.0) -
first から last までの範囲オブジェクトを生成して返しま す。
...オブジェクトの場合][ruby]{
Range.new(1, 10) # => 1..10
Range.new(1, 10, true) # => 1...10
//}
//emlist[例: 日付オブジェクトの範囲オブジェクトの場合][ruby]{
require 'date'
Range.new(Date.today, Date.today >> 1).each {|d| puts d }
# => 2017-09-16
# 2017-09-17
#......y]{
require 'ipaddr'
Range.new(IPAddr.new("192.0.2.1"), IPAddr.new("192.0.2.3")).each {|ip| puts ip}
# => 192.0.2.1
# 192.0.2.2
# 192.0.2.3
//}
//emlist[例: 自作のオブジェクトの場合][ruby]{
MyInteger = Struct.new(:value) do
def succ
self.class.new(value + 1)
end
def <=......>(other)
value <=> other.value
end
def to_s
value.to_s
end
end
Range.new(MyInteger.new(1), MyInteger.new(3)).each {|i| puts i }
# => 1
# 2
# 3
//}... -
Shell
:: Filter # |(filter) -> object (18136.0) -
パイプ結合を filter に対して行います。
...ll.def_system_command("tail")
Shell.def_system_command("head")
Shell.def_system_command("wc")
sh = Shell.new
sh.transact {
i = 1
while i <= (cat("/etc/passwd") | wc("-l")).to_s.chomp.to_i
puts (cat("/etc/passwd") | head("-n #{i}") | tail("-n 1")).to_s
i += 1
end
}... -
Thread
:: Backtrace :: Location # to _ s -> String (18131.0) -
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。
...mlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.to_s
end
# => path/to/foo.rb:5:in `initialize'
# path/to/foo.rb:9:in `new'
# path/to/foo.rb:9:in `<main>'
//}... -
Shell
:: Filter # to _ s -> String (18119.0) -
実行結果を文字列で返します。
...実行結果を文字列で返します。
require 'shell'
Shell.def_system_command("wc")
sh = Shell.new
sh.transact {
puts (cat("/etc/passwd") | wc("-l")).to_s
}... -
Module
# to _ s -> String (15138.0) -
モジュールやクラスの名前を文字列で返します。
...lass C
end
end
p A.name #=> "A"
p A::B.name #=> "A::B"
p A::C.name #=> "A::C"
# 名前のないモジュール / クラス
p Module.new.name #=> nil
p Class.new.name #=> nil
p Module.new.to_s #=> "#<Module:0x00007f90b09112c8>"
p Class.new.to_s #=> "#<Class:0x00007fa5c40b41b0>"
//}... -
OptionParser
# to _ s -> String (15131.0) -
サマリの文字列を返します。
...返します。
//emlist[例][ruby]{
require "optparse"
options = {}
opts = OptionParser.new do |opts|
opts.banner = "Usage: example.rb [options]"
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
options[:verbose] = v
end
end
puts opts.help
# => Usage: example.rb [options]
#... -
WIN32OLE
_ VARIABLE # to _ s -> String (15119.0) -
変数名を取得します。
...変数名を取得します。
@return 変数名を文字列で返します。
tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
puts "#{variable.name}" # => xlChart, xlDialogSheet, ...
end...