833件ヒット
[1-100件を表示]
(0.223秒)
別のキーワード
ライブラリ
- ビルトイン (473)
- erb (24)
-
irb
/ cmd / help (12) - json (60)
- logger (12)
- optparse (144)
- pathname (36)
-
rexml
/ document (72)
クラス
- ERB (24)
-
IRB
:: ExtendCommand :: Help (12) -
JSON
:: State (48) - Logger (12)
- Module (264)
- OptionParser (144)
- Pathname (36)
-
REXML
:: Attribute (24) -
REXML
:: Attributes (24) -
REXML
:: Element (24) - String (192)
- Struct (12)
- Symbol (5)
モジュール
キーワード
- % (12)
- [] (84)
- []= (24)
- attr (12)
-
attr
_ accessor (4) -
attr
_ reader (4) -
attr
_ writer (4) - binread (12)
-
class
_ variable _ get (12) -
class
_ variable _ set (12) -
const
_ defined? (12) -
const
_ get (12) -
const
_ source _ location (12) - execute (12)
- filename (12)
- filename= (12)
- formatter (12)
- inspect (12)
- intern (12)
-
method
_ defined? (12) -
module
_ function (12) - namespace (24)
- namespaces (24)
-
object
_ nl (12) -
object
_ nl= (12) - on (144)
- private (48)
-
private
_ method _ defined? (12) -
protected
_ method _ defined? (12) - public (12)
-
public
_ method _ defined? (12) -
remove
_ class _ variable (12) -
remove
_ const (12) - slice (72)
-
space
_ before (12) -
space
_ before= (12) - sub (24)
-
to
_ json (12) -
to
_ s (12) -
to
_ string (12) -
to
_ sym (12)
検索結果
先頭5件
-
REXML
:: Attribute # to _ string -> String (21555.0) -
"name='value'" という形式の文字列を返します。
..."name='value'" という形式の文字列を返します。
//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new("el")
e.add_attribute("ns:r", "rval")
p e.attributes.get_attribute("r").to_string # => "ns:r='rval'"
//}... -
Symbol
# name -> String (21427.0) -
シンボルに対応する文字列を返します。
...シンボルに対応する文字列を返します。
Symbol#to_sと違って freeze された文字列を返します。
//emlist[][ruby]{
p :fred.name # => "fred"
p :fred.name.frozen? # => true
p :fred.to_s # => "fred"
p :fred.to_s.frozen? # => false
//}
@see Symbol#to_s... -
JSON
:: Generator :: GeneratorMethods :: Object # to _ json(state _ or _ hash = nil) -> String (21338.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
tanaka = Person.new("ta......naka", 29)
tanaka.to_json # => "\"#<Person:0x00007ffdec0167c8>\""
tanaka.method(:to_json).owner # => JSON::Ext::Generator::GeneratorMethods::Object
//}... -
String
# intern -> Symbol (21319.0) -
文字列に対応するシンボル値 Symbol を返します。
...Symbol を返します。
なお、このメソッドの逆にシンボルに対応する文字列を得るには
Symbol#to_s または Symbol#id2name を使います。
シンボル文字列にはヌルキャラクタ("\0")、空の文字列の使用も可能です。
//emlist[例][ruby]{
p "fo......o".intern # => :foo
p "foo".intern.to_s == "foo" # => true
//}... -
Module
# protected _ method _ defined?(name , inherit=true) -> bool (18554.0) -
インスタンスメソッド name がモジュールに定義されており、 しかもその可視性が protected であるときに true を返します。 そうでなければ false を返します。
...ンスタンスメソッド name がモジュールに定義されており、
しかもその可視性が protected であるときに true を返します。
そうでなければ false を返します。
@param name Symbol か String を指定します。
@param inherit 真を指定するとス......ethod_defined?, Module#public_method_defined?, Module#private_method_defined?
//emlist[例][ruby]{
module A
def method1() end
end
class B
protected
def method2() end
end
class C < B
include A
def method3() end
end
A.method_defined? :method1 #=> true
C.protected_meth......od_defined? "method1" #=> false
C.protected_method_defined? "method2" #=> true
C.protected_method_defined? "method2", true #=> true
C.protected_method_defined? "method2", false #=> false
C.method_defined? "method2" #=> true
//}... -
Module
# name -> String | nil (18507.0) -
モジュールやクラスの名前を文字列で返します。
...Net::HTTP」が挙げられます。
@return 名前のないモジュール / クラスに対しては、name は nil を、それ以外はオブジェクト ID の文字列を返します。
//emlist[例][ruby]{
module A
module B
end
p B.name #=> "A::B"
class C
end
end
p A.name #......=> "A"
p A::B.name #=> "A::B"
p A::C.name #=> "A::C"
# 名前のないモジュール / クラス
p Module.new.name #=> nil
p Class.new.name #=> nil
p Module.new.to_s #=> "#<Module:0x00007f90b09112c8>"
p Class.new.to_s #=> "#<Class:0x00007fa5c40b41b0>"
//}... -
Module
# class _ variable _ get(name) -> object (18448.0) -
クラス/モジュールに定義されているクラス変数 name の値を返します。
...変数 name の値を返します。
@param name String または Symbol を指定します。
@raise NameError クラス変数 name が定義されていない場合、発生します。
//emlist[例][ruby]{
class Fred
@@foo = 99
end
def Fred.foo
class_variable_get(:@@foo)
end
p Fred.foo #... -
Module
# class _ variable _ set(name , val) -> object (18442.0) -
クラス/モジュールにクラス変数 name を定義して、その値として val をセットします。val を返します。
...数 name を定義して、その値として
val をセットします。val を返します。
@param name String または Symbol を指定します。
//emlist[例][ruby]{
class Fred
@@foo = 99
def foo
@@foo
end
end
def Fred.foo(val)
class_variable_set(:@@foo, val)
end
p Fred.foo......(101) # => 101
p Fred.new.foo # => 101
//}... -
Pathname
# binread(*args) -> String | nil (18414.0) -
IO.binread(self.to_s, *args)と同じです。
...IO.binread(self.to_s, *args)と同じです。
//emlist[例][ruby]{
require "pathname"
pathname = Pathname("testfile")
pathname.binread # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
pathname.binread(20) # => "This is line one\nThi"
pathname.binread(2......0, 10) # => "ne one\nThis is line "
//}
@see IO.binread...