80件ヒット
[1-80件を表示]
(0.326秒)
ライブラリ
- ビルトイン (80)
キーワード
- casecmp (11)
- casecmp? (8)
- intern (22)
-
transform
_ keys! (17)
検索結果
先頭5件
-
Symbol
# to _ sym -> self (26101.0) -
self を返します。
self を返します。
例:
:foo.intern # => :foo
@see String#intern -
String
# to _ sym -> Symbol (23201.0) -
文字列に対応するシンボル値 Symbol を返します。
...値 Symbol を返します。
なお、このメソッドの逆にシンボルに対応する文字列を得るには
Symbol#to_s または Symbol#id2name を使います。
シンボル文字列にはヌルキャラクタ("\0")、空の文字列の使用も可能です。
//emlist[例][ruby]{
p... -
Symbol
# casecmp?(other) -> bool | nil (11106.0) -
大文字小文字の違いを無視しシンボルを比較します。 シンボルが一致する場合には true を返し、一致しない場合には false を返します。
...@param other 比較対象のシンボルを指定します。
//emlist[][ruby]{
:abcdef.casecmp?(:abcde) #=> false
:aBcDeF.casecmp?(:abcdef) #=> true
:abcdef.casecmp?(:abcdefg) #=> false
:abcdef.casecmp?(:ABCDEF) #=> true
:"\u{e4 f6 fc}".casecmp?(:"\u{c4 d6 dc}") #=> true
//}
other......がシンボルではない場合や、文字列のエンコーディングが非互換の場合は、nil を返します。
//emlist[][ruby]{
:foo.casecmp?("foo") #=> nil
"\u{e4 f6 fc}".encode("ISO-8859-1").to_sym.casecmp?(:"\u{c4 d6 dc}") #=> nil
//}
@see String#casecmp?, Symbol#casecmp... -
Symbol
# casecmp(other) -> -1 | 0 | 1 | nil (11006.0) -
Symbol#<=> と同様にシンボルに対応する文字列の順序を比較しますが、 アルファベットの大文字小文字の違いを無視します。
...mbol#<=> と同様にシンボルに対応する文字列の順序を比較しますが、
アルファベットの大文字小文字の違いを無視します。
@param other 比較対象のシンボルを指定します。
//emlist[][ruby]{
:aBcDeF.casecmp(:abcde) #=> 1
:aBcDeF.casecmp(:ab......cdef) #=> 0
:aBcDeF.casecmp(:abcdefg) #=> -1
:abcdef.casecmp(:ABCDEF) #=> 0
:"\u{e4 f6 fc}".casecmp(:"\u{c4 d6 dc}") #=> 1
//}
other がシンボルではない場合や、文字列のエンコーディングが非互換の場合は、nil を返します。
//emlist[][ruby]{
:foo.casecmp("......foo") #=> nil
"\u{e4 f6 fc}".encode("ISO-8859-1").to_sym.casecmp(:"\u{c4 d6 dc}") #=> nil
//}
@see String#casecmp, Symbol#<=>, Symbol#casecmp?......Symbol#<=> と同様にシンボルに対応する文字列の順序を比較しますが、
アルファベットの大文字小文字の違いを無視します。
Symbol#casecmp? と違って大文字小文字の違いを無視するのは
Unicode 全体ではなく、A-Z/a-z だけです。
@......param other 比較対象のシンボルを指定します。
//emlist[][ruby]{
:aBcDeF.casecmp(:abcde) #=> 1
:aBcDeF.casecmp(:abcdef) #=> 0
:aBcDeF.casecmp(:abcdefg) #=> -1
:abcdef.casecmp(:ABCDEF) #=> 0
:"\u{e4 f6 fc}".casecmp(:"\u{c4 d6 dc}") #=> 1
//}
other がシンボルではな......い場合や、文字列のエンコーディングが非互換の場合は、nil を返します。
//emlist[][ruby]{
:foo.casecmp("foo") #=> nil
"\u{e4 f6 fc}".encode("ISO-8859-1").to_sym.casecmp(:"\u{c4 d6 dc}") #=> nil
//}
@see String#casecmp, Symbol#<=>, Symbol#casecmp?... -
Symbol
# intern -> self (11001.0) -
self を返します。
self を返します。
例:
:foo.intern # => :foo
@see String#intern -
String
# intern -> Symbol (8101.0) -
文字列に対応するシンボル値 Symbol を返します。
...値 Symbol を返します。
なお、このメソッドの逆にシンボルに対応する文字列を得るには
Symbol#to_s または Symbol#id2name を使います。
シンボル文字列にはヌルキャラクタ("\0")、空の文字列の使用も可能です。
//emlist[例][ruby]{
p... -
Hash
# transform _ keys! -> Enumerator (8036.0) -
すべてのキーに対してブロックを呼び出した結果でハッシュのキーを変更します。 値は変化しません。
...を
返します。
//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_keys! {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys!(&:to_sym) # => {:a=>1, :b=>2, :c=>3}
h.transform_keys!(a: "a", d: "d") # => {"a"=>1, :b=>2, :c=>3}
h.transform_keys!.with_index {|k, i|......"#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}
@see Hash#transform_keys
@see Hash#transform_values
@see Hash#transform_values!... -
Hash
# transform _ keys! {|key| . . . } -> self (8036.0) -
すべてのキーに対してブロックを呼び出した結果でハッシュのキーを変更します。 値は変化しません。
...を
返します。
//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_keys! {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys!(&:to_sym) # => {:a=>1, :b=>2, :c=>3}
h.transform_keys!(a: "a", d: "d") # => {"a"=>1, :b=>2, :c=>3}
h.transform_keys!.with_index {|k, i|......"#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}
@see Hash#transform_keys
@see Hash#transform_values
@see Hash#transform_values!... -
Hash
# transform _ keys!(hash) -> self (8036.0) -
すべてのキーに対してブロックを呼び出した結果でハッシュのキーを変更します。 値は変化しません。
...を
返します。
//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_keys! {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys!(&:to_sym) # => {:a=>1, :b=>2, :c=>3}
h.transform_keys!(a: "a", d: "d") # => {"a"=>1, :b=>2, :c=>3}
h.transform_keys!.with_index {|k, i|......"#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}
@see Hash#transform_keys
@see Hash#transform_values
@see Hash#transform_values!... -
Hash
# transform _ keys! -> Enumerator (8030.0) -
すべてのキーに対してブロックを呼び出した結果でハッシュのキーを変更します。 値は変化しません。
...//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_keys! {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys!(&:to_sym) # => {:a=>1, :b=>2, :c=>3}
h.transform_keys!.with_index {|k, i| "#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}... -
Hash
# transform _ keys! {|key| . . . } -> self (8030.0) -
すべてのキーに対してブロックを呼び出した結果でハッシュのキーを変更します。 値は変化しません。
...//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_keys! {|k| k.to_s } # => {"a"=>1, "b"=>2, "c"=>3}
h.transform_keys!(&:to_sym) # => {:a=>1, :b=>2, :c=>3}
h.transform_keys!.with_index {|k, i| "#{k}.#{i}" }
# => {"a.0"=>1, "b.1"=>2, "c.2"=>3}
//}...