80件ヒット
[1-80件を表示]
(0.019秒)
種類
- 特異メソッド (24)
- ライブラリ (24)
- 文書 (20)
- インスタンスメソッド (12)
ライブラリ
- json (36)
クラス
-
JSON
:: Parser (24)
モジュール
- JSON (12)
キーワード
-
NEWS for Ruby 2
. 5 . 0 (8) -
create
_ id (12) - new (12)
-
rdoc
/ parser / ruby (12) -
rexml
/ parsers / streamparser (12) -
ruby 1
. 6 feature (12)
検索結果
先頭5件
-
JSON
:: Parser # parse -> object (21113.0) -
現在のソースをパースして結果を Ruby のオブジェクトとして返します。
...す。
//emlist[例][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"
per......son.age # => 20
__END__
{
"name":"tanaka",
"age":20
}
//}
@see JSON::Parser#source... -
rexml
/ parsers / streamparser (12024.0) -
ストリーム式の XML パーサ。
...サの中では高速ですが、機能は限定的です。
もう少し高機能なストリーム式パーサが必要な場合は
REXML::Parsers::SAX2Parser を用いてください。
パーサからはコールバックによってパースした情報を受け取ります。
REXML::StreamLis......バーライドしたクラスのオブジェクトを
コールバックオブジェクトとして REXML::Parsers::StreamParser.new
に渡します。
REXML::Parsers::StreamParser#parse を呼び出すと
パースが開始しその結果によってコールバックが呼び出されます。......ruby]{
require 'rexml/parsers/baseparser'
require 'rexml/parsers/streamparser'
require 'rexml/streamlistener'
class Listener
include REXML::StreamListener
def initialize
@events = []
end
def text(text)
@events << "text[#{text}]"
end
def tag_start(name, attrs)
@events << "ta... -
rdoc
/ parser / ruby (6048.0) -
Ruby のソースコードを解析するためのサブライブラリです。
...い場合、## でコメントを開始します。
##
# This is a meta-programmed method!
add_my_method :meta_method, :arg1, :arg2
RDoc::Parser::Ruby は上記の :meta_method ようにメソッドの定義を行
うような識別子の後に続くトークンをメソッド名として......についても同様に :attr:、 :attr_reader:、 :attr_writer:、
:attr_accessor: を指定する事ができます。属性の名前は省略できます。
##
# :attr_reader: my_attr_name
=== 隠しメソッド、属性
:method:、 :singleton-method: や :attr: 命令を使う事で実......際には定義され
ていないメソッドもドキュメントに含める事ができます。
##
# :attr_writer: ghost_writer
# There is an attribute here, but you can't see it!
##
# :method: ghost_method
# There is a method here, but you can't see it!
##
# this is a commen... -
JSON
:: Parser . new(source , options => {}) -> JSON :: Parser (3112.0) -
パーサを初期化します。
...ます。
@param options オプションを指定するためのハッシュです。
//emlist[例][ruby]{
require 'json'
parser = JSON::Parser.new(DATA.read)
print parser.source
# => {
# => "Tanaka": {
# => "name":"tanaka",
# => "age":20
# => },
# => "Suzuki": {
# => "name":"s......lass を指定する][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"
per... -
ruby 1
. 6 feature (36.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...7 feature>)) の 2002-06-24 も参照)
p "#{ "" # comment }"
=> ruby 1.6.8 (2002-10-04) [i586-linux]
""
=> -:1: parse error
ruby 1.7.3 (2002-10-04) [i586-linux]
: SizedQueue#deq, #shift
: SizedQueue#enq
追加(push, pop の別名)。これらが定......ruby '-*' -v
=> ruby 1.6.7 (2002-03-01) [i586-linux]
=> ruby: invalid option -* (-h will show valid options)
: 2002-05-22 parsedate
バージョンアップ((<ruby-dev:17171>))
: 2002-05-22 -T オプション
ruby のコマンドラインオプション -T の後に......ことがありました。((<ruby-dev:13752>))
: attr_*
アクセサに余計な引数を渡してもエラーになりませんでした。
((<ruby-dev:13748>))
class C
def initialize
@message = 'ok'
end
attr_reader :message
end
puts C.new.message(1,2,3... -
NEWS for Ruby 2
. 5 . 0 (30.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...* Method
* Method#=== は Proc#===と同じようにMethod#callを呼び出します 14142
* Module
* Module#attr, Module#attr_accessor, Module#attr_reader, Module#attr_writer はパブリックメソッドになりました 14132
* Module#define_method, Module#alias_method, Module#u......n to a keyword argument
https://github.com/ruby/psych/pull/342
* Add :symbolize_names option to Psych.load, Psych.safe_load like JSON.parse
https://github.com/ruby/psych/pull/333, https://github.com/ruby/psych/pull/337
* Add Psych::Handler#event_location
https://g... -
JSON
. create _ id -> String (12.0) -
json_create メソッドで使用するクラスを決定するために使用する値を返します。
...決定するために使用する値を返します。
デフォルトは "json_class" です。
//emlist[例][ruby]{
require "json"
class User
attr :id, :name
def initialize(id, name)
@id, @name = id, name
end
def self.json_create(object)
new(object['id'], object["name"])
end......> id,
"name" => name,
}
end
def to_json(*)
as_json.to_json
end
end
json = JSON.generate(User.new(1, "tanaka"))
json # => "{\"json_class\":\"User\",\"id\":1,\"name\":\"tanaka\"}"
JSON.parse(json, create_additions: true)
# => #<User:0x0000557709b269e0 @id=1, @name="tanaka">
//}...