ライブラリ
- ビルトイン (768)
- csv (24)
- forwardable (72)
- json (24)
-
minitest
/ spec (1) -
minitest
/ unit (2) - pp (12)
- prime (72)
-
rdoc
/ context (12) -
rubygems
/ command _ manager (12) - singleton (12)
- syslog (12)
-
webrick
/ httpservlet / abstract (12) -
webrick
/ httpservlet / prochandler (12) - zlib (12)
クラス
- BasicObject (48)
- CSV (24)
-
Gem
:: CommandManager (12) -
JSON
:: Parser (24) - Method (12)
- Module (240)
- Object (241)
- Prime (72)
-
RDoc
:: Context (12) - UnboundMethod (144)
-
WEBrick
:: HTTPServlet :: AbstractServlet (12) -
WEBrick
:: HTTPServlet :: ProcHandler (12)
モジュール
- Enumerable (24)
- Forwardable (72)
- Kernel (48)
-
MiniTest
:: Assertions (2) - Singleton (12)
- Syslog (12)
オブジェクト
- main (24)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - == (12)
- === (24)
- Marshal フォーマット (12)
-
NEWS for Ruby 3
. 0 . 0 (5) - Ruby プログラムの実行 (12)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- TYPES (12)
- ZStream (12)
- arity (12)
-
assert
_ instance _ of (1) -
assert
_ kind _ of (1) - bind (12)
-
bind
_ call (12) - class (12)
-
class
_ eval (24) -
class
_ variables (12) - clone (12)
- constants (24)
-
def
_ delegator (12) -
def
_ delegators (12) -
def
_ instance _ delegator (12) -
def
_ instance _ delegators (12) -
define
_ method (48) - delegate (12)
- each (24)
- eql? (12)
- eval (24)
-
get
_ instance (24) -
global
_ variables (12) - grep (24)
-
initialize
_ copy (12) - inspect (12)
-
instance
_ delegate (12) -
instance
_ eval (24) -
instance
_ exec (12) -
instance
_ method (12) -
instance
_ methods (12) -
instance
_ of? (12) -
instance
_ variable _ defined? (12) -
instance
_ variable _ get (12) -
instance
_ variable _ set (12) -
instance
_ variables (12) -
int
_ from _ prime _ division (12) - irb (12)
-
irb
/ completion (12) -
is
_ a? (12) -
kind
_ of? (12) -
local
_ variables (12) - method (12)
-
method
_ added (12) - methods (12)
-
module
_ eval (24) -
must
_ be _ instance _ of (1) - name (12)
- new (12)
-
original
_ name (12) - owner (12)
- parameters (12)
- parse (12)
-
pretty
_ print _ instance _ variables (12) - prime? (12)
-
prime
_ division (12) -
private
_ instance _ methods (12) -
private
_ methods (12) -
protected
_ instance _ methods (12) -
protected
_ methods (12) -
public
_ instance _ method (12) -
public
_ instance _ methods (12) -
public
_ method (12) -
public
_ methods (12) -
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ instance _ variable (12) -
respond
_ to? (12) -
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 4 feature (12) -
singleton
_ method (12) -
singleton
_ method _ undefined (12) -
source
_ location (12) -
to
_ s (12) -
undef
_ method (12) - クラス/メソッドの定義 (12)
- パターンマッチ (4)
検索結果
-
irb
/ completion (66.0) -
irb の completion 機能を提供するライブラリです。
...):001:0> in
in inspect instance_eval
include install_alias_method instance_of?
initialize install_aliases instance_variables
irb(main):001:0> inspect
"main"
irb(main):002:0> foo = Object.new
#<Object:0x4027146c>
"変......数名." の後に [Tab] を押すと, そのオブジェクトのメソッド一覧がでます.
irb(main):003:0> foo.
foo.== foo.frozen? foo.protected_methods
foo.=== foo.hash foo.public_methods
foo.=~ foo.id......d__ foo.inspect foo.send
foo.__send__ foo.instance_eval foo.singleton_methods
foo.class foo.instance_of? foo.taint
foo.clone foo.instance_variables foo.tainted?
foo.display foo.is_a? foo.t... -
Marshal フォーマット (54.0)
-
Marshal フォーマット フォーマットバージョン 4.8 を元に記述しています。
...れ、'0', 'T', 'F' になります。
//emlist[][ruby]{
p Marshal.dump(nil).unpack1("x2 a*") # => "0"
p Marshal.dump(true).unpack1("x2 a*") # => "T"
p Marshal.dump(false).unpack1("x2 a*") # => "F"
//}
Ruby 2.1 以前では、インスタンス変数を設定しても dump されません。
Ru......めです。
//emlist[例][ruby]{
p Marshal.dump(-1).unpack1("x2 a*") # => "i\xFA"
p Marshal.dump(0).unpack1("x2 a*") # => "i\x00"
p Marshal.dump(1).unpack1("x2 a*") # => "i\x06"
p Marshal.dump(2).unpack1("x2 a*") # => "i\a" ("i\x07")
//}
形式 1 の範囲を超える数値 N に対しては......acC*") # => ["i", 2, 0, 1]
p foo(2, 0, 1) # => 256
//}
Ruby 1.9.3 以前では、インスタンス変数を設定しても dump されません。
Ruby 2.0 以降は freeze されているので、インスタンス変数は設定できません。
=== instance of the use... -
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (54.0)
-
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) ex q num per and or plus minus ast slash hat sq period comma langl rangl eq tilde dollar at under lbrarbra lbra2rbra2 lbra3rbra3 dq colon ac backslash semicolon
...繰り返し。
===[a:num] #
: #コメント
d:spec/lexical#comment。# から行末までがコメントになります。
: xxx #=> 実行結果
: xxx # => 実行結果
慣用的に実行結果を示すために使われるコメントの書き方。
: #! ruby -Ks
shebang。d:spec/rubycmd......: utf-8
マジックコメント。d:spec/m17n#magic_comment を参照。
: "a is #{a}"
d:spec/literal#exp
//emlist{
a = 10
p "a is #{a}" #=> "a is 10"
//}
: Range#each
説明文の中でのみ使われます。Ruby言語の要素ではありません。クラスのインスタンスメ......d:spec/variables#instanceを参照。
: @@xxx
クラス変数。d:spec/variables#classを参照。
: def +@ または def -@
単項演算子 +X や -X を定義するときの表記法。
//emlist{
class Symbol
def +@
self.upcase
end
end
puts(+:joke) #=> JOKE
//}
===[a:un... -
クラス/メソッドの定義 (36.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...erclass ]
式..
end
文法:
class 識別子 [`<' superclass ]
式..
[rescue [error_type,..] [=> evar] [then]
式..]..
[else
式..]
[ensure
式..]
end
クラスを定義します......的に指定しても同じ)
class Foo
def bar
end
end
# 間違ったスーパークラスを指定するとエラー
class Foo < String
end
# => superclass mismatch for class Foo (TypeError)
//}
クラス定義式の中は self がそのクラスであることと、
limitのデフォルト......式やinstance_eval)でのみ呼び出せます。
//emlist[例: protected の可視性][ruby]{
class Foo
def foo
p caller.last
end
protected :foo
end
obj = Foo.new
# そのままでは呼べない
obj.foo rescue nil # => -:11 - protected method `foo' called for #<Foo:0x401a1860> (Nam... -
NEWS for Ruby 3
. 0 . 0 (30.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...o keywords.
16166
//emlist[][ruby]{
pr = proc{|*a, **kw| [a, kw]}
pr.call([1])
# 2.7 => [[1], {}]
# 3.0 => [[[1]], {}]
pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 => a=>1}, {}]
//}
* Arguments forwarding (`...`) now supports leading arguments.
16378
//......ENTAL]
* `=>` is added. It can be used like a rightward assignment.
17260
* `in` is changed to return `true` or `false`. 17371
//emlist{
0 => a
p a #=> 0
{b: 0, c: 1} => {b:}
p b #=> 0
//}
//emlist{
# version 3.0
0 in 1 #=> false
# version 2.7
0 in 1 #=> raise NoMatchingP......ace.
8661
== Core classes updates
Outstanding ones only.
* Array
* The following methods now return Array instances instead of subclass instances when called on subclass instances: 6087
* Array#drop
* Array#drop_while
* Array#flatten
* Array#slice!
* Array#slic... -
Ruby プログラムの実行 (30.0)
-
Ruby プログラムの実行 === Ruby プログラム
...ます。Module#module_eval/class_eval、
BasicObject#instance_eval
の三つだけが例外で、以下のように変更されます。
: Module#module_eval, Module#class_eval
self、class ともそのレシーバ
: BasicObject#instance_eval
self がそのレシーバ、class がそのレ......ム上にないなら例外 LocalJumpError
を発生します。
next ブロックの終わりまでジャンプ
retry 複雑だ…
==== eval, instance_eval, module_eval
これなんだっけ
=== 代入
代入とは、変数・定数のいずれかにオブジェクトを記憶させること......some_iterator do |a,b|
....
end
次のような操作がまず実行されます。
a, b = <some_iterator から yield された値>
==== インスタンス変数
インスタンス変数はひとつのオブジェクトに所属し、そのオブジェクトを
self とする... -
Zlib
:: ZStream (12.0) -
圧縮データを扱うストリームを表す抽象クラスです。 具体的な圧縮/展開の操作は、それぞれサブクラスの Zlib::Deflate, Zlib::Inflate で定義されています。
...データは、一旦入力バッファの
末尾にストアされた後、ストリームからの出力がなくなるまで
(処理後 avail_out > 0 となるまで) 入力バッファの先頭から順に処理されます。
処理の間、出力バッファは全出力を保持するために......取り出し、
String オブジェクトとして返します。
以上を図示すると次のようになります:
+================ an instance of Zlib::ZStream ================+
|| ||
|| +--------+ +------...