るりまサーチ

最速Rubyリファレンスマニュアル検索!
1080件ヒット [1-100件を表示] (0.068秒)

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

クラス

検索結果

<< 1 2 3 ... > >>

Object#class -> Class (21287.0)

レシーバのクラスを返します。

...レシーバのクラスを返します。

//emlist[][ruby]{
p "ruby".class #=> String
p 100.class #=> Integer
p ARGV.class #=> Array
p self.class #=> Object
p Class.class #=> Class
p Kernel.class #=> Module
//}

@
see Class#superclass,Object#kind_of?,Object#instance_of?...

JSON::Generator::GeneratorMethods::FalseClass#to_json(state_or_hash = nil) -> String (12119.0)

自身から生成した JSON 形式の文字列を返します。

...ら生成した JSON 形式の文字列を返します。

"false" という文字列を返します。

@
param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
JSON::State のインスタンスか、
J
SON::State.new...
...の引数と同じ Hash を
指定します。

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

false.to_json # => "false"
//}...

JSON::Generator::GeneratorMethods::NilClass#to_json(state_or_hash = nil) -> String (12119.0)

自身から生成した JSON 形式の文字列を返します。

...ら生成した JSON 形式の文字列を返します。

"null" という文字列を返します。

@
param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
JSON::State のインスタンスか、
J
SON::State.new の...
...引数と同じ Hash を
指定します。

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

nil.to_json # => "null"
//}...

JSON::Generator::GeneratorMethods::TrueClass#to_json(state_or_hash = nil) -> String (12119.0)

自身から生成した JSON 形式の文字列を返します。

...ら生成した JSON 形式の文字列を返します。

"true" という文字列を返します。

@
param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
JSON::State のインスタンスか、
J
SON::State.new の...
...引数と同じ Hash を
指定します。

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

true.to_json # => "true"
//}...

Object#singleton_class -> Class (9263.0)

レシーバの特異クラスを返します。 まだ特異クラスがなければ、新しく作成します。

...れ NilClass, TrueClass,
FalseClass を返します。

@
raise TypeError レシーバが Integer、Float、Symbol の場合に発生します。

//emlist[][ruby]{
Object.new.singleton_class #=> #<Class:#<Object:0xb7ce1e24>>
String.singleton_class #=> #<Class:String>
nil.singleton_class...
...#=> NilClass
//}

@
see Object#class...

絞り込み条件を変える

Class#new(*args, &block) -> object (9149.0)

自身のインスタンスを生成して返します。 このメソッドの引数はブロック引数も含め Object#initialize に渡されます。

...ブロック引数も含め Object#initialize に渡されます。

new は Class#allocate でインスタンスを生成し、
Object#initialize で初期化を行います。

@
param args Object#initialize に渡される引数を指定します。

@
param block Object#initialize に渡される...
...ブロックを指定します。

//emlist[例][ruby]{
# Class クラスのインスタンス、C クラスを生成
C = Class.new # => C

# Class クラスのインスタンス、C クラスのインスタンスを生成
C.new # => #<C:0x00005623f8b4e458>
//}...

JSON::Generator::GeneratorMethods::Object#to_json(state_or_hash = nil) -> String (9137.0)

自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。

...にした結果を JSON 形式の文字列に変換して返します。

このメソッドはあるオブジェクトに to_json メソッドが定義されていない場合に使用する
フォールバックのためのメソッドです。

@
param state_or_hash 生成する JSON 形式の文...
... JSON::State のインスタンスか、
J
SON::State.new の引数と同じ Hash を
指定します。

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

class
Person
attr :name, :age

def initialize(name, age)
@
name, @age = name, age
end...
...end

tanaka = Person.new("tanaka", 29)

tanaka.to_json # => "\"#<Person:0x00007ffdec0167c8>\""
tanaka.method(:to_json).owner # => JSON::Ext::Generator::GeneratorMethods::Object
//}...

Class#allocate -> object (9131.0)

自身のインスタンスを生成して返します。生成したオブジェクトは 自身のインスタンスであること以外には何も特性を持ちません。

...ェクトは
自身のインスタンスであること以外には何も特性を持ちません。

//emlist[例][ruby]{
klass = Class.new do
def initialize(*args)
@
initialized = true
end

def initialized?
@
initialized || false
end
end

klass.allocate.initialized? #=> false
//}...

ERB#def_class(superklass=Object, methodname=&#39;erb&#39;) -> Class (6395.0)

変換した Ruby スクリプトをメソッドとして定義した無名のクラスを返します。

... Ruby スクリプトをメソッドとして定義した無名のクラスを返します。


@
param superklass 無名クラスのスーパークラス

@
param methodname メソッド名

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

class
MyClass_
def initialize(arg1, arg2)
@
arg1 = arg1; @arg2 =...
...arg2
end
end
filename = 'example.rhtml' # @arg1 と @arg2 が使われている example.rhtml

erb = ERB.new(File.read(filename))
erb.filename = filename
MyClass = erb.def_class(MyClass_, 'render()')
print MyClass.new('foo', 123).render()

# => test1foo
# test2123
//}...
<< 1 2 3 ... > >>