るりまサーチ

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

別のキーワード

  1. string []=
  2. string slice!
  3. string slice
  4. string []
  5. string gsub!

クラス

検索結果

<< 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 (15315.0)

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

...ます。

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

//emlist[例][ruby]{
requir...
...e "json"

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

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

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

...ます。

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

//emlist[例][ruby]{
requir...
...e "json"

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

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

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

...の文字列を返します。

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

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

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

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

Object#singleton_class -> Class (12381.0)

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

... true か false なら、それぞれ 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...

絞り込み条件を変える

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

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

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

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

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

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

class
Person
attr :name, :age

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

t
anaka = Person.new("ta...
...naka", 29)

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

Module#public_class_method(*name) -> self (12269.0)

name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を public に変更します。

...

@
param name 0 個以上の String または Symbol を指定します。
@
param names 0 個以上の String または Symbol を Array で指定します。

//emlist[例][ruby]{
class
Foo
def self.foo
"foo"
end

private_class_method :foo
end

Foo.foo # NoMethodError: private method...
...`foo' called for Foo:Class

Foo.public_class_method(:foo) # => Foo
Foo.foo # => "foo"
//}...

Module#public_class_method(names) -> self (12269.0)

name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を public に変更します。

...

@
param name 0 個以上の String または Symbol を指定します。
@
param names 0 個以上の String または Symbol を Array で指定します。

//emlist[例][ruby]{
class
Foo
def self.foo
"foo"
end

private_class_method :foo
end

Foo.foo # NoMethodError: private method...
...`foo' called for Foo:Class

Foo.public_class_method(:foo) # => Foo
Foo.foo # => "foo"
//}...

Module#private_class_method(*name) -> self (12263.0)

name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を private に変更します。

...性を private に変更します。

@
param name 0 個以上の String または Symbol を指定します。
@
param names 0 個以上の String または Symbol を Array で指定します。

//emlist[例][ruby]{
module Foo
def self.foo; end
end

Foo.singleton_class.private_method_defined?(:f...
...oo) # => false
Foo.private_class_method(:foo) # => Foo
Foo.singleton_class.private_method_defined?(:foo) # => true
//}...
<< 1 2 3 ... > >>