種類
- 文書 (66)
- インスタンスメソッド (22)
- ライブラリ (11)
- モジュール (11)
- 特異メソッド (11)
ライブラリ
- ビルトイン (22)
-
json
/ add / range (22)
クラス
- Range (33)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - Enumerable (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 2
. 6 . 0 (6) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) - Ruby用語集 (11)
-
json
_ create (11) -
to
_ json (11) - yaml (11)
- リテラル (11)
検索結果
先頭5件
-
Range
# hash -> Integer (39129.0) -
始端と終端のハッシュ値と Range#exclude_end? の値からハッシュ値を計算して整数として返します。
...始端と終端のハッシュ値と Range#exclude_end? の値からハッシュ値を計算して整数として返します。
//emlist[例][ruby]{
p (1..2).hash # => 5646
p (1...2).hash # => 16782863
//}... -
Range
. json _ create(hash) -> Range (21208.0) -
JSON のオブジェクトから Ruby のオブジェクトを生成して返します。
...JSON のオブジェクトから Ruby のオブジェクトを生成して返します。
@param hash 適切なキーを持つハッシュを指定します。... -
Range
# to _ json(*args) -> String (21024.0) -
自身を JSON 形式の文字列に変換して返します。
...:Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
(1..5).to_json # => "{\"json_class\":\"Range\",\"a\":[1,5,false]}"
//}
@s......ee JSON::Generator::GeneratorMethods::Hash#to_json... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (306.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への変更点(まとめ)/サポートプラットフォームの追加>))
...((<ENV/ENV.clear>)) [new]
: ((<ENV/ENV.shift>)) [new]
: ((<ENV/ENV.invert>)) [new]
: ((<ENV/ENV.replace>)) [new]
: ((<ENV/ENV.update>)) [new]
((<Hash>)) との互換性のために定義されました。
=== Enumerable
: ((<Enumerable#partition|Enumerable/partition>)) [new]
追加
: ((<Enu......[new]
追加。
=== Hash
: ((<Hash#merge|Hash/merge>)) [new]
: ((<Hash#merge!|Hash/merge!>)) [new]
追加。Hash#merge は、hash.dup.update と同じ。
Hash#merge! は、Hash#update の別名 ((<ruby-talk:59777>)), ((<ruby-dev:19463>))
: ((<Hash#default_proc|Hash/default_proc>)) [new]......ess::Status#pid|Process::Status/pid>)) [new]
追加
=== Range
: ((<Range#step|Range/step>)) [new]
追加。step ごとの要素で繰り返します。
: ((<Range#include?|Range/include?>)) [new]
: ((<Range#member?|Range/member?>)) [new]
追加
=== Regexp
: ((<Reg... -
NEWS for Ruby 2
. 6 . 0 (132.0) -
NEWS for Ruby 2.6.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...* 定数名の先頭の文字に ASCII 以外の大文字も使えるようになりました。 13770
* 終端なし Range が導入されました。 終端なし Range は (0..) や (0...) のように使うことができます。 12912
典型的なユースケースは以下の通......Python のスライスのようなものを表現するために使えます。
このクラスのインスタンスは Numeric#step や Range#step で得られます。
* Enumerator::Chain
* 1個の Enumerator で複数の Enumerable の連鎖を表現する新しいクラスで......と :order を受け付けるようになりました。 14324
* Hash
* 変更されたメソッド
* Hash#merge, Hash#merge!, Hash#update が引数を複数受け付けるようになりました。 15111
* Hash#to_h はブロックを受け取りキーと値のペアを新し... -
NEWS for Ruby 2
. 7 . 0 (102.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...bar
lambda
end
bar { puts "Hello" } #=> tried to create Proc object without a block (ArgumentError)
//}
==== その他の変更
* 始端なしRangeが実験的に導入されました。
caseやComparable#clampや定数やDSLなどで便利かもしれません。
14799
//emlist[][rub......ワード引数やブロックを含む)を bar に転送します。
注意点として括弧は必須です。「bar ...」は終端なし Range と解釈されます。
//emlist[][ruby]{
def foo(...)
bar(...)
end
//}
* 「$SAFE」の参照や代入は警告が表示されるように......のプラットフォームでrealpath(3)を使います。
これは大幅にパフォーマンスを改善します。 15797
* Hash
* 小さいHashオブジェクトのデータ構造が変わりました。 15602
* Monitor
* MonitorクラスがC拡張になりました。 1625... -
Ruby用語集 (78.0)
-
Ruby用語集 A B C D E F G I J M N O R S Y
...ンの
間でオブジェクトにアクセスできる。
===[a:E] E
: ENV
環境変数にアクセスするためのオブジェクト。
Hash に似たインターフェースを持つ。キーも値も文字列である。
ENV で環境変数を変更すると Ruby の子プロセス......「可変長引数」という用語の
ほうが普及している。
英語の variadic は形容詞である。
: 空
: empty
Array や Hash、Struct のような要素を持つクラスでは、要素が無いことを
「空(から)」と呼ぶ。
また、String クラスで......ーを明示して
呼び出すなど、構文上、メソッド名であることが明らかな場面では使える場合もある。
実際 Range クラスには begin、end というインスタンスメソッドが定義されている。
また、インスタンス変数、クラス変... -
yaml (78.0)
-
構造化されたデータを表現するフォーマットであるYAML (YAML Ain't Markup Language) を扱うためのライブラリです。
...ray: Array オブジェクト
* !ruby/class: Class オブジェクト
* !ruby/hash: Hash オブジェクト
* !ruby/module: Module オブジェクト
* !ruby/regexp: Regexp オブジェクト
* !ruby/range: Range オブジェクト
* !ruby/string: String オブジェクト
* !ruby/struct:......'
p YAML.load(<<~EOS)
---
array: !ruby/array [1, 2, 3]
hash: !ruby/hash {foo: 1, bar: 2}
regexp: !ruby/regexp /foo|bar/
range: !ruby/range 1..10
EOS
# => {"regexp"=>/foo|bar/, "hash"=>{"foo"=>1, "bar"=>2}, "array"=>[1, 2, 3], "range"=>1..10}
//}
これらは tag:ruby.yaml.org,2002:array......。
//emlist[例][ruby]{
require 'yaml'
p YAML.load(<<~EOS)
---
array: !tag:ruby.yaml.org,2002:array [1, 2, 3]
hash: !tag:ruby.yaml.org,2002:hash {foo: 1, bar: 2}
EOS
# => {"hash"=>{"foo"=>1, "bar"=>2}, "array"=>[1, 2, 3]}
//}
自分で定義したクラスなどは !ruby/object:<クラス... -
NEWS for Ruby 3
. 0 . 0 (72.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ob and Dir.[] now sort the results by default, and accept the `sort:` keyword option. 8709
* ENV
* ENV.except has been added, which returns a hash excluding the given keys and their values. 15822
* Windows: Read ENV names and values as UTF-8 encoded Strings 12650
* Encoding
* Added......cant overhead to major collections, so please test first! 17176
* Hash
* Hash#transform_keys and Hash#transform_keys! now accept a hash that maps keys to new keys. 16274
* Hash#except has been added, which returns a hash excluding the given keys and their values. 15822
* IO
* IO#n......= Compatibility issues
Excluding feature bug fixes.
* Regexp literals and all Range objects are frozen. 8948 16377 15504
//emlist[][ruby]{
/foo/.frozen? #=> true
(42...).frozen? # => true
//}
* EXPERIMENTAL: Hash#each consistently yields a 2-element array. 12706
* Now `{ a: 1 }.each(&->(... -
NEWS for Ruby 2
. 0 . 0 (66.0) -
NEWS for Ruby 2.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...uffle! と Array#sample の random パラメータには最大値のみを指定することが可能になりました
* Array#values_at に Range オブジェクトを与えた場合、配列の範囲外のインデックスについては nil を返します
* Enumerable
* 追加: En......一つ受け取るようになりました
* 新規クラス: Enumerator::Lazy 遅延列挙用のクラス
* ENV
* ENV.to_h は ENV.to_hash へのエイリアスです
* Fiber
* 非互換: Fiber#resume は Fiber#transfer を呼び出したファイバーを再開できなくなり......ofiler.raw_data GCの加工していないプロファイルデータを返します
* Hash
* 追加: Hash#to_h 明示的に変換するメソッドです。Array#to_a に似ています
* 拡張: Hash#default_proc= default proc をクリアするために nil を渡せるようになり... -
NEWS for Ruby 2
. 5 . 0 (66.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...ようになりました
* File.lutime を追加 4052
* Hash
* Hash#transform_keys を追加 13583
* Hash#transform_keys! を追加 13583
* Hash#slice を追加 8499
* IO
* IO.copy_stream は copy_file_range(2) を使うようになりました。また、その実装が......しました 11952
* Process.last_status を追加。$? と同じです 14043
* Range
* Range.new no longer hides exceptions when comparing begin and
end with #<=> and raise a "bad value for range" ArgumentError
but instead lets the exception from the #<=> call go through.......0, nil, ...] }
//}
* drb
* ACL::ACLEntry.new は IPAddr::InvalidPrefixError を抑制しなくなりました
* erb
* ERB#result_with_hash を追加。
ハッシュで与えられたローカル変数とともにテンプレートを描画します。8631
* erbコマンドの... -
リテラル (56.0)
-
リテラル * num * string * backslash * exp * char * command * here * regexp * array * hash * range * symbol * percent
...リテラル
* num
* string
* backslash
* exp
* char
* command
* here
* regexp
* array
* hash
* range
* symbol
* percent
数字の1や文字列"hello world"のようにRubyのプログラムの中に直接
記述できる値の事をリテラルといいます。
===[a:n......の
配列表現も指定できます。
配列式は評価されるたびに毎回新しい配列オブジェクトを生成します。
===[a:hash] ハッシュ式
//emlist[][ruby]{
{ 1 => 2, 2 => 4, 3 => 6}
{ :a => "A", :b => "B", :c => "C" }
{ a:"A", b:"B", c:"C" } # 一つ上の例と同じ......とするハッシュオブジェク
トを返します。ハッシュとは任意のオブジェクトをキー(添字)として持
つ配列で、Hashクラスのインスタンスです。
メソッドの引数、もしくはarrayの末尾に要素が1つ以上の
ハッシュを渡す場合は...