るりまサーチ

最速Rubyリファレンスマニュアル検索!
796件ヒット [401-500件を表示] (0.099秒)
トップページ > クエリ:ruby[x] > クエリ:Ruby[x] > クエリ:string[x] > クエリ:String[x] > クエリ:method[x] > 種類:インスタンスメソッド[x]

別のキーワード

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

検索結果

<< < ... 3 4 5 6 7 ... > >>

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

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

...e 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 fo...
...r Foo:Class

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

Object#define_singleton_method(symbol) { ... } -> Symbol (6152.0)

self に特異メソッド name を定義します。

...ymbol メソッド名を String または Symbol で指定します。

@param method Proc、Method あるいは UnboundMethod
いずれかのインスタンスを指定します。

@return メソッド名を表す Symbol を返します。

//emlist[][ruby]{
class A
class << se...
...lf
def class_name
to_s
end
end
end
A.define_singleton_method(:who_am_i) do
"I am: #{class_name}"
end
A.who_am_i # ==> "I am: A"

guy = "Bob"
guy.define_singleton_method(:hello) { "#{self}: Hello there!" }
guy.hello #=> "Bob: Hello there!"
//}...

UnboundMethod#inspect -> String (3259.0)

self を読みやすい文字列として返します。

...self を読みやすい文字列として返します。

詳しくは Method#inspect を参照してください。

//emlist[例][ruby]{
String
.instance_method(:count).inspect # => "#<UnboundMethod: String#count>"
//}

@see Method#inspect...

UnboundMethod#to_s -> String (3259.0)

self を読みやすい文字列として返します。

...self を読みやすい文字列として返します。

詳しくは Method#inspect を参照してください。

//emlist[例][ruby]{
String
.instance_method(:count).inspect # => "#<UnboundMethod: String#count>"
//}

@see Method#inspect...

UnboundMethod#source_location -> [String, Integer] | nil (3257.0)

ソースコードのファイル名と行番号を配列で返します。

... ruby で定義されていない(つまりネイティブ
である)場合は nil を返します。

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

Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2...
....4.0/time.rb", 654]
//}

@see Proc#source_location, Method#source_location...

絞り込み条件を変える

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

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

...st[例][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::Obje...

JSON::Generator::GeneratorMethods::Array#to_json(state_or_hash = nil) -> String (3215.0)

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

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

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

[1, 2, 3].to_json # => "[1,2,3]"
//}...

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

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

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

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

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

JSON::Generator::GeneratorMethods::Float#to_json(state_or_hash = nil) -> String (3215.0)

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

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

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

(1.0).to_json # => "1.0"
//}...
<< < ... 3 4 5 6 7 ... > >>