るりまサーチ

最速Rubyリファレンスマニュアル検索!
173件ヒット [1-100件を表示] (0.024秒)
トップページ > クエリ:end[x] > クエリ:generate[x]

別のキーワード

  1. _builtin end
  2. ripper end_seen?
  3. _builtin exclude_end?
  4. _builtin end_with?
  5. range end

ライブラリ

クラス

モジュール

検索結果

<< 1 2 > >>

JSON.#generate(object, state = nil) -> String (18131.0)

与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。

...fore
a string that is put before a : pair delimiter (default: '')
: :object_nl
a string that is put at the end of a JSON object (default: '')
: :array_nl
a string that is put at the end of a JSON array (default: '')
: :check_circular
真を指定した場合、生成するオブジェクト...
...on"

JSON.generate([1, 2, { name: "tanaka", age: 19 }])
# => "[1,2,{\"name\":\"tanaka\",\"age\":19}]"
json_state = JSON::State.new(space: " ")
JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => "[1,2,{\"name\": \"tanaka\",\"age\": 19}]"
//}

@see JSON::State, JSON.#pretty_generate...

CSV.generate(str = "", options = Hash.new) {|csv| ... } -> String (18113.0)

このメソッドは与えられた文字列をラップして CSV のオブジェクトとしてブロックに渡します。 ブロック内で CSV オブジェクトに行を追加することができます。 ブロックを評価した結果は文字列を返します。

...,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS

csv = CSV.generate(text, headers: true) do |csv|
csv.add_row(["5", "saburo", "kondo", "34"])
end


print csv
# => id,first name,last name,age
# 1,taro,tanaka,20
# 2,jiro,suzuki,18
# 3,ami,sato,19
# 4,yum...

JSON.#unparse(object, state = nil) -> String (3031.0)

与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。

...fore
a string that is put before a : pair delimiter (default: '')
: :object_nl
a string that is put at the end of a JSON object (default: '')
: :array_nl
a string that is put at the end of a JSON array (default: '')
: :check_circular
真を指定した場合、生成するオブジェクト...
...on"

JSON.generate([1, 2, { name: "tanaka", age: 19 }])
# => "[1,2,{\"name\":\"tanaka\",\"age\":19}]"
json_state = JSON::State.new(space: " ")
JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => "[1,2,{\"name\": \"tanaka\",\"age\": 19}]"
//}

@see JSON::State, JSON.#pretty_generate...

NEWS for Ruby 3.0.0 (54.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...> a=>1}, {}]
//}

* Arguments forwarding (`...`) now supports leading arguments.
16378

//emlist{
def method_missing(meth, ...)
send(:"do_#{meth}", ...)
end

//}

* Pattern matching (`case/in`) is no longer experimental. 17260
* One-line pattern matching is redesigned. [EXPERIMENTAL]...
..."f", 3]
in [*pre, String => x, String => y, *post]
p pre #=> ["a", 1]
p x #=> "b"
p y #=> "c"
p post #=> [2, "d", "e", "f", 3]
end

//}

* Endless method definition is added. [EXPERIMENTAL]
16746

//emlist{
def square(x) = x * x
//}

* Interpolated String literals are no long...
...ero?`
* `Struct`: reader methods for 10th or later members
* Constant references are inlined.
* Always generate appropriate code for `==`, `nil?`, and `!` calls depending on a receiver class.
* Reduce the number of PC accesses on branches and method returns.
* Optimize C meth...

ruby 1.8.2 feature (42.0)

ruby 1.8.2 feature ruby 1.8.2 での ruby 1.8.1 からの変更点です。

...]
セッションを保存するファイル名にセッション ID が使われるバグを修正しました。

=== 2004-08-23
: OpenSSL::SSL#pending [lib] [new]

=== 2004-08-14
: FileUtils.copy_entry [lib] [new]
: FileUtils::DryRun [lib] [new]
追加。
: FileUtils.mv [lib] [compat]
mv...
...いるバグを修正しました。((<ruby-dev:23690>))

$ ruby1.8.1 -e 'class X;end; x=X.new; class << x;p self < X; end'
true

$ ruby1.8.2 -e 'class X;end; x=X.new; class << x;p self < X; end'
nil

=== 2004-06-04

: IO#gets, $_ [ruby] [change]
gets の返り値が nil で...
...ow [lib] [obsolete]
: CSV::Cell [lib] [obsolete]
CSV::Row と CSV::Cell が deprecated になりました。

: CSV.open, CSV.parse, and CSV,generate
必要ならばユーザが binmode をセットしなければならなくなりました。

: CSV.read [lib] [new]
: CSV.readlines [li...

絞り込み条件を変える

CSV (36.0)

このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。

...SV.foreach("sample.csv") do |row|
p row
end

# => ["Ruby", "1995"]
# ["Rust", "2010"]

# ファイルから一度に
p CSV.read("sample.csv")
# => [["Ruby", "1995"], ["Rust", "2010"]]

# 文字列から一行ずつ
CSV.parse(csv_text) do |row|
p row
end

# => ["Ruby", "1995"]
# ["Rust", "201...
...csv|
csv << ["row", "of", "CSV", "data"]
csv << ["another", "row"]
# ...
end


# 文字列へ書き込み
csv_string = CSV.generate do |csv|
csv << ["row", "of", "CSV", "data"]
csv << ["another", "row"]
# ...
end

//}

=== 一行変換

//emlist[][ruby]{
require 'csv'

csv_string = ["CSV",...
...is not ASCII compatible. There's no existing data for CSV to use to
prepare itself and thus you will probably need to manually specify the desired
Encoding for most of those cases. It will try to guess using the fields in a
row of output though, when using CSV::generate_line() or Array#to_csv()....

JSON.create_id -> String (36.0)

json_create メソッドで使用するクラスを決定するために使用する値を返します。

...@name = id, name
end


def self.json_create(object)
new(object['id'], object["name"])
end


def as_json(*)
{
JSON.create_id => self.class.name,
"id" => id,
"name" => name,
}
end


def to_json(*)
as_json.to_json
end

end


json = JSON.generate(User.new(1, "t...

rdoc/generator/json_index (30.0)

他のジェネレータが生成する HTML で検索が行えるように、JSON の検索インデッ クスを生成するサブライブラリです。

.....
@base_dir = Pathname.pwd.expand_path

@json_index = RDoc::Generator::JsonIndex.new self, options
end


def generate
# ...
@json_index.generate
end

end


=== インデックスフォーマット

検索用のインデックスは JSON ファイルに出力され...

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...
<< 1 2 > >>