1223件ヒット
[101-200件を表示]
(0.063秒)
別のキーワード
種類
- インスタンスメソッド (961)
- 定数 (238)
- 特異メソッド (24)
ライブラリ
- ビルトイン (1111)
-
minitest
/ spec (16) - pp (60)
- psych (36)
キーワード
- !~ (12)
- <=> (12)
- == (12)
- === (12)
- =~ (9)
- ARGF (12)
- ARGV (12)
- DATA (12)
- ENV (12)
- FALSE (8)
- NIL (8)
-
RUBY
_ COPYRIGHT (12) -
RUBY
_ DESCRIPTION (12) -
RUBY
_ ENGINE (12) -
RUBY
_ ENGINE _ VERSION (10) -
RUBY
_ PATCHLEVEL (12) -
RUBY
_ PLATFORM (12) -
RUBY
_ RELEASE _ DATE (12) -
RUBY
_ REVISION (12) -
RUBY
_ VERSION (12) -
SCRIPT
_ LINES _ _ (12) - STDERR (12)
- STDIN (12)
- STDOUT (12)
-
TOPLEVEL
_ BINDING (12) - TRUE (8)
-
_ dump (12) - class (12)
- clone (12)
-
define
_ singleton _ method (24) - display (12)
- dup (12)
-
enum
_ for (24) - eql? (12)
- equal? (12)
- extend (12)
- freeze (12)
- frozen? (12)
- hash (12)
- initialize (12)
-
initialize
_ clone (12) -
initialize
_ copy (12) -
initialize
_ dup (12) - inspect (12)
-
instance
_ of? (12) -
instance
_ variable _ defined? (12) -
instance
_ variable _ get (12) -
instance
_ variable _ set (12) -
instance
_ variables (12) -
is
_ a? (12) - itself (12)
-
kind
_ of? (12) -
marshal
_ dump (12) -
marshal
_ load (12) - method (12)
- methods (12)
-
must
_ be (1) -
must
_ be _ close _ to (1) -
must
_ be _ empty (1) -
must
_ be _ instance _ of (1) -
must
_ be _ kind _ of (1) -
must
_ be _ nil (1) -
must
_ be _ same _ as (1) -
must
_ be _ within _ delta (1) -
must
_ be _ within _ epsilon (1) -
must
_ equal (1) -
must
_ include (1) -
must
_ match (1) -
must
_ raise (1) -
must
_ respond _ to (1) -
must
_ send (1) -
must
_ throw (1) - new (12)
- nil? (12)
-
object
_ id (12) -
pretty
_ inspect (12) -
pretty
_ print (12) -
pretty
_ print _ cycle (12) -
pretty
_ print _ inspect (12) -
pretty
_ print _ instance _ variables (12) -
private
_ methods (12) -
protected
_ methods (12) -
psych
_ to _ yaml (12) -
public
_ method (12) -
public
_ methods (12) -
public
_ send (24) -
remove
_ instance _ variable (12) -
respond
_ to? (12) -
respond
_ to _ missing? (12) - send (24)
-
singleton
_ class (12) -
singleton
_ method (12) -
singleton
_ methods (12) - taint (9)
- tainted? (9)
- tap (12)
- then (14)
-
to
_ a (12) -
to
_ ary (12) -
to
_ enum (24) -
to
_ hash (12) -
to
_ int (12) -
to
_ io (12) -
to
_ proc (12) -
to
_ regexp (12) -
to
_ s (12) -
to
_ str (12) -
to
_ yaml (12) - trust (9)
- untaint (9)
- untrust (9)
- untrusted? (9)
-
yaml
_ tag (12) -
yield
_ self (16)
検索結果
先頭5件
-
Object
# public _ method(name) -> Method (107.0) -
オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。
...vate メソッド名を引数として与えると発生します。
//emlist[][ruby]{
1.public_method(:to_int) #=> #<Method: Integer#to_int>
1.public_method(:p) # method `p' for class `Integer' is private (NameError)
//}
@see Object#method,Object#public_send,Module#public_instance_method... -
Object
# singleton _ class -> Class (107.0) -
レシーバの特異クラスを返します。 まだ特異クラスがなければ、新しく作成します。
...します。
@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... -
Object
# singleton _ method(name) -> Method (107.0) -
オブジェクトの特異メソッド name をオブジェクト化した Method オブ ジェクトを返します。
...o.new(99)
def k.hi
"Hi, @iv = #{@iv}"
end
m = k.singleton_method(:hi) # => #<Method: #<Demo:0xf8b0c3c4 @iv=99>.hi>
m.call #=> "Hi, @iv = 99"
m = k.singleton_method(:hello) # => NameError
//}
@see Module#instance_method, Method, BasicObject#__send__, Object#send, Kernel.#eval, Object#method... -
Object
# to _ enum(method = :each , *args) -> Enumerator (107.0) -
Enumerator.new(self, method, *args) を返します。
...][ruby]{
str = "xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def rep......each do |*val|
n.times { yield *val }
end
end
end
%i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.first(4) # => [1, 1, 1, 2]
enum.size # => 42
//}
@see Enumerator, Enumerator#size... -
Object
# to _ enum(method = :each , *args) {|*args| . . . } -> Enumerator (107.0) -
Enumerator.new(self, method, *args) を返します。
...][ruby]{
str = "xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumerable
def rep......each do |*val|
n.times { yield *val }
end
end
end
%i[hello world].repeat(2) { |w| puts w }
# => 'hello', 'hello', 'world', 'world'
enum = (1..14).repeat(3)
# => #<Enumerator: 1..14:repeat(3)>
enum.first(4) # => [1, 1, 1, 2]
enum.size # => 42
//}
@see Enumerator, Enumerator#size... -
Object
# to _ s -> String (107.0) -
オブジェクトの文字列表現を返します。
...使って文字列に変換し
ます。
//emlist[][ruby]{
class Foo
def initialize num
@num = num
end
end
it = Foo.new(40)
puts it #=> #<Foo:0x2b69110>
class Foo
def to_s
"Class:Foo Number:#{@num}"
end
end
puts it #=> Class:Foo Number:40
//}
@see Object#to_str,Kernel.#String... -
Object
. new -> Object (107.0) -
Objectクラスのインスタンスを生成して返します。
...
Objectクラスのインスタンスを生成して返します。
//emlist[][ruby]{
some = Object.new
p some #=> #<Object:0x2b696d8>
//}... -
Object
# !~(other) -> bool (101.0) -
自身が other とマッチしない事を判定します。
...身が other とマッチしない事を判定します。
self#=~(obj) を反転した結果と同じ結果を返します。
@param other 判定するオブジェクトを指定します。
//emlist[例][ruby]{
obj = 'regexp'
p (obj !~ /re/) # => false
obj = nil
p (obj !~ /re/) # => true
//}... -
Object
# ==(other) -> bool (101.0) -
オブジェクトと other が等しければ真を返します。
...o = Object.new
p(o.eql?(o)) #=> true
p(o.eql?(Object.new)) #=> false
//}
下記の例のように、各クラスの性質に合わせて再定義されることが期待されています。
//emlist[適切に再定義されている例][ruby]{
p("foo" == "bar") #=> false
p("foo" == "foo") #=> tr......ue
p(4 == 4) #=> true
p(4 == 4.0) #=> true
//}
@see Object#equal?,Object#eql?...