るりまサーチ

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

別のキーワード

  1. argf.class each
  2. argf.class each_line
  3. argf.class lines
  4. class new
  5. argf.class gets

ライブラリ

クラス

モジュール

検索結果

Class#json_creatable? -> bool (9012.0)

シリアライズされた JSON 形式の文字列から、インスタンスを作成するのにこのクラスを使用できる場合は 真を返します。そうでない場合は、偽を返します。

...そうでない場合は、偽を返します。

このメソッドが真を返すクラスは json_create というメソッドを実装していなければなりません。
また json_create の第一引数は必要なデータを含むハッシュを期待しています。

//emlist[例][rub...

JSON.create_id=(identifier) (6171.0)

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

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

@param identifier 識別子を指定します。

//emlist[例][ruby]{
require "json"
require "json/add/core"

JSON.create_id # => "json_class"
puts (1..5).to_json...
...# => {"json_class":"Range","a":[1,5,false]}
JSON.create_id = "my_json_class" # => "my_json_class"
JSON.create_id # => "my_json_class"
puts (1..5).to_json # => {"my_json_class":"Range","a":[1,5,false]}
//}...

JSON.create_id -> String (6159.0)

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

...son_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(ob...
...{
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, "tanaka"))
json # => "{\"json_class\":\"User\",\"id\":1,\"name\":\"tanaka\"}"
JSON.parse(json, create_additions: true)...

JSON::Parser.new(source, options => {}) -> JSON::Parser (42.0)

パーサを初期化します。

...: :create_additions
偽を指定するとマッチするクラスや ID があっても付加情報を生成しません。デフォルトは真です。
: :object_class
JSON のオブジェクトを変換するクラスを指定します。デフォルトは Hash です。
: :array_class
JSO...
...//emlist[例 object_class を指定する][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.n...

NEWS for Ruby 2.1.0 (42.0)

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

...* Module
* 追加: Module#using, which activates refinements of the specified module only
in the current class or module definition.
* 追加: Module#singleton_class? レシーバーが特異クラスであれば true を返します。
レシーバーが通常のクラスや...
...の外側には影響を与えないという意味です。
以下のコードは Foo#foo をプライベートにしません。
//emlist{
class
Foo
eval "private"
def foo
end
end
//}

* Object#untrusted?,Object#untrust,Object#trust
* これらのメソッドは...
...うになりました。

* Proc
* Returning from lambda proc now always exits from the Proc, not from the
method where the lambda is created. Returning from non-lambda proc exits
from the method, same as the former behavior.

* String
* 以下のコードでレシーバー...

絞り込み条件を変える

NEWS for Ruby 2.7.0 (42.0)

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

...で呼び出すと
例外が発生するようになりました。

//emlist[][ruby]{
def bar
lambda
end
bar { puts "Hello" } #=> tried to create Proc object without a block (ArgumentError)
//}

==== その他の変更

* 始端なしRangeが実験的に導入されました。
caseやC...
...ted です。 15575
この警告は「-W:no-deprecated」オプションで止められます。

//emlist{
def foo
class
<< Object.new
yield #=> warning: `yield' in class syntax will not be supported from Ruby 3.0. 15575
end
end
foo { p :ok }
//}

* 引数を転送する記法「(...)...
...sday?) #=> next Tuesday
//}
//emlist[Enumerator::Lazy#eager][ruby]{
a = %w(foo bar baz)
e = a.lazy.map {|x| x.upcase }.map {|x| x + "!" }.eager
p e.class #=> Enumerator
p e.map {|x| x + "?" } #=> ["FOO!?", "BAR!?", "BAZ!?"]
//}
//emlist[Enumerator::Lazy#with_index][ruby]{
("a"..).lazy...

ruby 1.8.4 feature (36.0)

ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。

...g eval should preserve external
# information.

: super [bug]

Kernelのメソッド内でsuperを呼んだ時に、存在しないsuperclass
にアクセスしようとするバグの修正。

module Kernel
def foo
super
end
end...
...tring
: super: no superclass method `foo' (NoMethodError)
from -:7

: 正規表現 [bug]

#Wed Oct 19 01:27:07 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
#
# * regex.c (re_compile_pattern): numeric literal inside character class
# disabled succeeding back...
...xt.c (MakeX509ExtFactory): should use
# OPENSSL_malloc to allocate X509V3_CTX.
#
# * ext/openssl/ossl_x509ext.c (ossl_x509extfactory_create_ext): use
# X509V3_EXT_nconf_nid to avoid SEGV (and to build extensions which
# values are placed in separate section).
#
#...

ERB.new(str, safe_level=NOT_GIVEN, trim_mode=NOT_GIVEN, eoutvar=NOT_GIVEN, trim_mode: nil, eoutvar: &#39;_erbout&#39;) -> ERB (18.0)

eRubyスクリプト から ERB オブジェクトを生成して返します。

...た。
trim_mode と eoutvar の指定はキーワード引数に移行してください。

//emlist[例][ruby]{
require "erb"

# build data class
class
Listings
PRODUCT = { :name => "Chicken Fried Steak",
:desc => "A well messages pattie, breaded and fried.",
:cost =...
...r :product, :price

def initialize( product = "", price = "" )
@product = product
@price = price
end

def build
b = binding
# create and run templates, filling member data variables
ERB.new(<<~'END_PRODUCT', eoutvar: "@product").result b
<%= PRODUCT[:name] %>
<%...

ERB.new(str, safe_level=nil, trim_mode=nil, eoutvar=&#39;_erbout&#39;) -> ERB (18.0)

eRubyスクリプト から ERB オブジェクトを生成して返します。

...た。
trim_mode と eoutvar の指定はキーワード引数に移行してください。

//emlist[例][ruby]{
require "erb"

# build data class
class
Listings
PRODUCT = { :name => "Chicken Fried Steak",
:desc => "A well messages pattie, breaded and fried.",
:cost =...
...r :product, :price

def initialize( product = "", price = "" )
@product = product
@price = price
end

def build
b = binding
# create and run templates, filling member data variables
ERB.new(<<-'END_PRODUCT'.gsub(/^\s+/, ""), 0, "", "@product").result b
<%= PRODUCT[:na...

ERB.new(str, trim_mode: nil, eoutvar: &#39;_erbout&#39;) -> ERB (18.0)

eRubyスクリプト から ERB オブジェクトを生成して返します。

...ときに変更
します。通常は指定する必要はありません。


//emlist[例][ruby]{
require "erb"

# build data class
class
Listings
PRODUCT = { :name => "Chicken Fried Steak",
:desc => "A well messages pattie, breaded and fried.",
:cost =...
...r :product, :price

def initialize( product = "", price = "" )
@product = product
@price = price
end

def build
b = binding
# create and run templates, filling member data variables
ERB.new(<<~'END_PRODUCT', eoutvar: "@product").result b
<%= PRODUCT[:name] %>
<%...

絞り込み条件を変える