173件ヒット
[101-173件を表示]
(0.025秒)
クラス
- CSV (48)
-
JSON
:: State (12)
モジュール
- JSON (48)
キーワード
- CSV (12)
-
NEWS for Ruby 3
. 0 . 0 (5) - RSA (12)
-
check
_ circular? (12) -
create
_ id (12) - dump (12)
-
force
_ quotes? (12) - new (12)
-
rdoc
/ generator (12) -
rdoc
/ generator / json _ index (12) -
ruby 1
. 8 . 2 feature (12) - unparse (12)
-
write
_ headers? (12)
検索結果
先頭5件
-
CSV
# force _ quotes? -> bool (24.0) -
出力される全てのフィールドがクオートされる場合は、真を返します。
...ult = CSV.generate(force_quotes: false) do |csv|
rows.each { |row| csv << row }
csv.force_quotes? # => false
end
print result
# => header1,header2
# "row1_1,",row1_2
//}
//emlist[例][ruby]{
require "csv"
rows = [["header1", "header2"], ["row1_1,", "row1_2"]]
result = CSV.generate(force_qu......otes: true) do |csv|
rows.each { |row| csv << row }
csv.force_quotes? # => true
end
print result
# => true
# => "header1","header2"
# "row1_1,","row1_2"
//}
@see CSV.new... -
CSV
# write _ headers? -> bool (24.0) -
ヘッダを出力先に書き込む場合は真を返します。 そうでない場合は偽を返します。
..."row1_2"]
result = CSV.generate(headers: header, write_headers: false) do |csv|
csv.write_headers? # => false
csv << row
end
result # => "row1_1,row1_2\n"
result = CSV.generate(headers: header, write_headers: true) do |csv|
csv.write_headers? # => true
csv << row
end
result # => "header1,h... -
OpenSSL
:: PKey :: RSA (24.0) -
RSA 暗号鍵のクラスです。
...RSA 暗号鍵のクラスです。
通常このクラスで利用するのは、
OpenSSL::PKey::RSA.generate, OpenSSL::PKey::RSA.new,
OpenSSL::PKey::RSA#public?, OpenSSL::PKey::RSA#private?,
OpenSSL::PKey::RSA#public_key, OpenSSL::PKey::RSA#to_text,
OpenSSL::PKey::RSA#to_pem, OpenSSL::PKey::RSA#to_......rsa = OpenSSL::PKey::RSA.generate(2048)
# 秘密鍵をAES256で暗号化して private_key.pem に PEM 形式で保存
passphrase = "!secret passphrase!"
File.open("private_key.pem", "w") do |f|
f.write(rsa.export(OpenSSL::Cipher.new("aes256"), passphrase))
end
# 公開鍵をpublic_ke......y.pemに保存
public_key = rsa.public_key
File.open("public_key.pem", "w") do |f|
f.write(public_key.export)
end
# 秘密鍵で署名
data = "foobar"
sign = rsa.sign("sha256", data)
# 公開鍵で検証
p public_key.verify("sha256", sign, data)
# 不正なデータを検証... -
JSON
:: State # check _ circular? -> bool (18.0) -
循環参照のチェックを行う場合は、真を返します。 そうでない場合は偽を返します。
...]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
s = JSON.state.new
begin
JSON.generate(a, s)
rescue JSON::NestingError => e
[e, s.max_nesting, s.check_circular?] # => [#<JSON::NestingError: nesting of 100 is too deep>, 100, true]
end
//}
//emlist[例 ネストをチェックしないケース][ruby]{
r......]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
s2 = JSON.state.new(max_nesting: 0)
json = JSON.generate(a, s2)
[json, s2.max_nesting, s2.check_circular?] # => ["[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[... -
CSV
. new(data , options = Hash . new) -> CSV (12.0) -
このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。
...をラップします。
ラップされた文字列の先頭から読み込むことになります。
文字列に追記したい場合は CSV.generate を使用してください。
他の位置から処理したい場合はあらかじめそのように設定した StringIO を渡してくだ......r" の並びまでを読みます。
A sequence will be selected even if it occurs in a quoted field, assuming that you
would have the same line endings there. If none of those sequences is
found, +data+ is ARGF, Object::STDIN, Object::STDOUT, or
Object::STDERR, or the stream is only avail......manually if speed is important. Also
note that IO objects should be opened in binary mode on Windows if this
feature will be used as the line-ending translation can cause
problems with resetting the document position to where it was before the
read ahead. This String will be transcoded... -
JSON
. # dump(object , io = nil , limit = nil) -> String | IO (12.0) -
与えられたオブジェクトを JSON 形式の文字列に変換してダンプします。
...たオブジェクトを JSON 形式の文字列に変換してダンプします。
与えられたオブジェクトを引数として JSON.#generate を呼び出します。
@param object ダンプするオブジェクトを指定します。
@param io IO のように write メソッドを......=> "{\"name\":\"tanaka\",\"age\":19}"
//}
//emlist[例][ruby]{
require "json"
File.open("test.txt", "w") do |f|
JSON.dump([[[[[[[[[[]]]]]]]]]], f, 10) # => #<File:test.txt>
JSON.dump([[[[[[[[[[[]]]]]]]]]]], f, 10) # => exceed depth limit (ArgumentError)
end
//}
@see Marshal, Marshal.#dump... -
rdoc
/ generator (12.0) -
RDoc が解析したソースコードを RDoc::CodeObject のツリーから その他の形式に出力するためのサブライブラリです。
....add_generator を呼び出す事でジェネレータの登録が行えます。
class My::Awesome::Generator
RDoc::RDoc.add_generator self
end
=== rdoc のオプションの追加
rdoc ではオプションの処理の前に RDoc::Options は各ジェネ
レータの #setup_options メ......、RDoc::TopLevel を使って記述された処理を置き換える必要が
あります。
RDoc は出力を行う際にジェネレータの generate メソッドを呼び出しま
す。RDoc::Store や RDoc::CodeObject のツリーのメソッドを使っ
て要求される形式のフォー...