クラス
- Array (24)
-
JSON
:: State (22) - NilClass (11)
-
OpenSSL
:: X509 :: Extension (11) - OpenStruct (17)
-
Rake
:: TaskArguments (11)
モジュール
- Enumerable (41)
検索結果
先頭5件
-
OpenSSL
:: X509 :: Extension # to _ h -> Hash (24102.0) -
拡張領域の内容を、 { "oid" => 識別子(extnID), "value" => 値(extnValue), "critical" => 重要度(critical) } というハッシュで返します。
...拡張領域の内容を、
{ "oid" => 識別子(extnID), "value" => 値(extnValue), "critical" => 重要度(critical) }
というハッシュで返します。... -
OpenStruct
# to _ h {|name , value| block } -> Hash (21215.0) -
self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返 します。
...t[例][ruby]{
require 'ostruct'
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
data.to_h # => {:country => "Australia", :capital => "Canberra" }
data.to_h {|name, value| [name.to_s, value.upcase] }
# => {"country" => "AUSTRALIA", "capital" => "CANBERRA" }
//}... -
Enumerable
# to _ h(*args) -> Hash (21115.0) -
self を [key, value] のペアの配列として解析した結果を Hash にして 返します。
...[例][ruby]{
%i[hello world].each_with_index.to_h # => {:hello => 0, :world => 1}
//}
ブロックを指定すると各要素でブロックを呼び出し、
その結果をペアとして使います。
//emlist[ブロック付きの例][ruby]{
(1..5).to_h {|x| [x, x ** 2]} # => {1=>1, 2=>4, 3=>... -
Enumerable
# to _ h(*args) { . . . } -> Hash (21115.0) -
self を [key, value] のペアの配列として解析した結果を Hash にして 返します。
...[例][ruby]{
%i[hello world].each_with_index.to_h # => {:hello => 0, :world => 1}
//}
ブロックを指定すると各要素でブロックを呼び出し、
その結果をペアとして使います。
//emlist[ブロック付きの例][ruby]{
(1..5).to_h {|x| [x, x ** 2]} # => {1=>1, 2=>4, 3=>... -
OpenStruct
# to _ h -> { Symbol => object } (21115.0) -
self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返 します。
...t[例][ruby]{
require 'ostruct'
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
data.to_h # => {:country => "Australia", :capital => "Canberra" }
data.to_h {|name, value| [name.to_s, value.upcase] }
# => {"country" => "AUSTRALIA", "capital" => "CANBERRA" }
//}... -
Enumerable
# to _ h(*args) -> Hash (21108.0) -
self を [key, value] のペアの配列として解析した結果を Hash にして 返します。
...self を [key, value] のペアの配列として解析した結果を Hash にして
返します。
@param args each の呼び出し時に引数として渡されます。
//emlist[例][ruby]{
%i[hello world].each_with_index.to_h # => {:hello => 0, :world => 1}
//}... -
JSON
:: State # to _ h -> Hash (21108.0) -
自身をハッシュに変換します。
...e "json"
require "pp"
json_state = JSON::State.new
pp json_state.to_h
# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,
# :max_nesting=>100,
# :depth=>0,
# :buffer_initial_length=>... -
NilClass
# to _ h -> {} (21108.0) -
{} を返します。
...{} を返します。
//emlist[例][ruby]{
nil.to_h #=> {}
//}... -
OpenStruct
# to _ h -> { Symbol => object } (21108.0) -
self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返 します。
...self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返
します。
//emlist[例][ruby]{
require 'ostruct'
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
data.to_h # => {:country => "Australia", :capital => "Canberra" }
//}... -
JSON
:: State # to _ hash -> Hash (9108.0) -
自身をハッシュに変換します。
...e "json"
require "pp"
json_state = JSON::State.new
pp json_state.to_h
# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,
# :max_nesting=>100,
# :depth=>0,
# :buffer_initial_length=>... -
Rake
:: TaskArguments # to _ hash -> Hash (9101.0) -
パラメータ名と対応する値を格納したハッシュを返します。
...納したハッシュを返します。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do
arguments = Rake::TaskArguments.new(["name1", "name2"], ["value1", "value2"])
arguments.to_hash # => {:name1=>"value1", :name2=>"value2"}
end
//}... -
Enumerable
# collect -> Enumerator (3119.0) -
各要素に対してブロックを評価した結果を全て含む配列を返します。
...配列を返します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
# すべて 3 倍にした配列を返す
p (1..3).map {|n| n * 3 } # => [3, 6, 9]
p (1..3).collect { "cat" } # => ["cat", "cat", "cat"]
//}
@see Hash#to_h, Array#collect, Array#map... -
Enumerable
# map -> Enumerator (3119.0) -
各要素に対してブロックを評価した結果を全て含む配列を返します。
...配列を返します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
# すべて 3 倍にした配列を返す
p (1..3).map {|n| n * 3 } # => [3, 6, 9]
p (1..3).collect { "cat" } # => ["cat", "cat", "cat"]
//}
@see Hash#to_h, Array#collect, Array#map...