96件ヒット
[1-96件を表示]
(0.035秒)
ライブラリ
- csv (12)
- json (24)
- optparse (48)
-
rdoc
/ parser / ruby (12)
クラス
- CSV (12)
-
JSON
:: Parser (12) - OptionParser (48)
-
RDoc
:: Parser :: Ruby (12)
モジュール
- JSON (12)
検索結果
先頭5件
- JSON
. parser -> JSON :: Ext :: Parser - JSON
:: Parser . new(source , options => {}) -> JSON :: Parser - RDoc
:: Parser :: Ruby . new(top _ level , file _ name , body , options , stats) -> RDoc :: Parser :: Ruby - OptionParser
. new(banner = nil , width = 32 , indent = & # 39; & # 39; * 4) -> OptionParser - OptionParser
. new(banner = nil , width = 32 , indent = & # 39; & # 39; * 4) {|opt| . . . } -> OptionParser
-
JSON
. parser -> JSON :: Ext :: Parser (21321.0) -
JSON ライブラリがパーサとして使用するクラスを返します。
...JSON ライブラリがパーサとして使用するクラスを返します。
//emlist[例][ruby]{
require "json"
JSON.parser # => JSON::Ext::Parser
//}... -
JSON
:: Parser . new(source , options => {}) -> JSON :: Parser (6350.0) -
パーサを初期化します。
...e_additions
偽を指定するとマッチするクラスや ID があっても付加情報を生成しません。デフォルトは真です。
: :object_class
JSON のオブジェクトを変換するクラスを指定します。デフォルトは Hash です。
: :array_class
JSON の配......source パーサの元となる文字列を指定します。
@param options オプションを指定するためのハッシュです。
//emlist[例][ruby]{
require 'json'
parser = JSON::Parser.new(DATA.read)
print parser.source
# => {
# => "Tanaka": {
# => "name":"tanaka",
# => "age......する][ruby]{
require 'json'
class Person
attr_accessor :name, :age
def []=(key, value)
instance_variable_set("@#{key}", value)
end
end
parser = JSON::Parser.new(DATA.read, object_class: Person)
person = parser.parse
person.class # => Person
person.name # => "tanaka"
person.age # =>... -
RDoc
:: Parser :: Ruby . new(top _ level , file _ name , body , options , stats) -> RDoc :: Parser :: Ruby (6303.0) -
自身を初期化します。
...を指定します。
@param file_name ファイル名を文字列で指定します。
@param body ソースコードの内容を文字列で指定します。
@param options RDoc::Options オブジェクトを指定します。
@param stats RDoc::Stats オブジェクトを指定します。... -
OptionParser
. new(banner = nil , width = 32 , indent = & # 39; & # 39; * 4) -> OptionParser (6219.0) -
OptionParser オブジェクトを生成して返します。
...tionParser オブジェクトを生成して返します。
ブロックが与えられた場合、生成した OptionParser オブジェクトを引数としてブロックを評
価します。つまり、以下のような書き方が可能です。
//emlist[][ruby]{
require 'optparse'
OptionPa......rser.new do |opt|
opt.on('-a') {|v| p v }
opt.on('-b') {|v| p v }
opt.parse!(ARGV)
end
//}
@param banner ヘルプ(サマリ)の最初の部分に表示される、アプリケーションの説明などを文字列で与えます。
@param width サマリの幅を整数で与えます。... -
OptionParser
. new(banner = nil , width = 32 , indent = & # 39; & # 39; * 4) {|opt| . . . } -> OptionParser (6219.0) -
OptionParser オブジェクトを生成して返します。
...tionParser オブジェクトを生成して返します。
ブロックが与えられた場合、生成した OptionParser オブジェクトを引数としてブロックを評
価します。つまり、以下のような書き方が可能です。
//emlist[][ruby]{
require 'optparse'
OptionPa......rser.new do |opt|
opt.on('-a') {|v| p v }
opt.on('-b') {|v| p v }
opt.parse!(ARGV)
end
//}
@param banner ヘルプ(サマリ)の最初の部分に表示される、アプリケーションの説明などを文字列で与えます。
@param width サマリの幅を整数で与えます。... -
OptionParser
. accept(klass , pat = / . * / ) {|str| . . . } -> () (6047.0) -
オプションの引数を文字列から Ruby のオブジェクトに変換するための ブロックを登録します。すべての OptionParser インスタンスに共通です。
...オプションの引数を文字列から Ruby のオブジェクトに変換するための
ブロックを登録します。すべての OptionParser インスタンスに共通です。
ブロックには、文字列として与えられるオプションの引数から klass のインスタ......ものを指定します。
OptionParser#on で klass を指定した場合、
コマンドラインのオプションに与えられた引数は、この accept で登録したブロックで
klass のインスタンスに変換されてから、OptionParser#on メソッドで登録したブロッ......クに渡されます。
//emlist[][ruby]{
require "optparse"
require "time"
OptionParser.accept(Time) do |s,|
begin
Time.parse(s) if s
rescue
raise OptionParser::InvalidArgument, s
end
end
opts = OptionParser.new
opts.on("-t", "--time [TIME]", Time) do |time|
p time.class #=> Ti... -
OptionParser
. reject(klass) -> () (6031.0) -
OptionParser.accept メソッドで登録したブロックを削除します。
...OptionParser.accept メソッドで登録したブロックを削除します。
@param klass 削除したいクラスオブジェクトを指定します。
//emlist[例][ruby]{
require "optparse"
require "time"
def parse(option_parser)
option_parser.on("-t", "--time [TIME]", Time) do |time|......p time.class
end
option_parser.parse(ARGV)
end
OptionParser.accept(Time) do |s,|
begin
Time.parse(s) if s
rescue
raise OptionParser::InvalidArgument, s
end
end
opts1 = OptionParser.new
parse(opts1) # => Time
OptionParser.reject(Time)
opts2 = OptionParser.new
parse(opts2) # => un... -
CSV
. new(data , options = Hash . new) -> CSV (131.0) -
このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。
...ンスタンスを指定した場合、CSV#string を使用して
後からデータを取り出すことが出来ます。
@param options CSV をパースするためのオプションをハッシュで指定します。
パフォーマンス上の理由でインスタ......If none of those sequences is
found, +data+ is ARGF, Object::STDIN, Object::STDOUT, or
Object::STDERR, or the stream is only available for output, the default
$INPUT_RECORD_SEPARATOR ($/) is used. Obviously,
discovery takes a little time. Set 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 into the data's Encoding before parsing.
:...