種類
- インスタンスメソッド (156)
- 文書 (41)
- ライブラリ (24)
- 特異メソッド (24)
- クラス (12)
クラス
- BasicObject (24)
- ERB (12)
- Module (12)
- Object (12)
-
WIN32OLE
_ EVENT (12) -
WIN32OLE
_ TYPE (12)
モジュール
- Enumerable (96)
キーワード
- ! (12)
- != (12)
-
NEWS for Ruby 2
. 5 . 0 (8) -
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) - Symbol (12)
-
default
_ event _ sources (12) - handler= (12)
- max (48)
- min (48)
- new (12)
-
rdoc
/ parser / ruby (12) -
rexml
/ parsers / streamparser (12) -
ruby 1
. 6 feature (12) -
ruby 1
. 9 feature (12) -
yaml
_ tag (12)
検索結果
先頭5件
-
Module
# attr _ reader(*name) -> [Symbol] (18125.0) -
インスタンス変数 name の読み取りメソッドを定義します。
...す。
//emlist[例][ruby]{
class User
attr_reader :name # => [:name]
# 複数の名前を渡すこともできる
attr_reader :id, :age # => [:id, :age]
end
//}
このメソッドで定義されるメソッドの定義は以下の通りです。
//emlist[例][ruby]{
def name
@name
end
//... -
Module
# attr _ reader(*name) -> nil (18107.0) -
インスタンス変数 name の読み取りメソッドを定義します。
...インスタンス変数 name の読み取りメソッドを定義します。
このメソッドで定義されるメソッドの定義は以下の通りです。
//emlist[例][ruby]{
def name
@name
end
//}
@param name String または Symbol を 1 つ以上指定します。... -
rdoc
/ parser / ruby (6034.0) -
Ruby のソースコードを解析するためのサブライブラリです。
...Ruby のソースコードを解析するためのサブライブラリです。
拡張子が .rb、.rbw のファイルを解析する事ができます。
=== メタプログラミングされたメソッド
動的に定義されたメソッドをドキュメントに含めたい場合、## で......コメントを開始します。
##
# This is a meta-programmed method!
add_my_method :meta_method, :arg1, :arg2
RDoc::Parser::Ruby は上記の :meta_method ようにメソッドの定義を行
うような識別子の後に続くトークンをメソッド名として解釈します。......ngleton-method: woo_hoo!
また、属性についても同様に :attr:、 :attr_reader:、 :attr_writer:、
:attr_accessor: を指定する事ができます。属性の名前は省略できます。
##
# :attr_reader: my_attr_name
=== 隠しメソッド、属性
:method:、 :singleton-meth... -
ruby 1
. 6 feature (5143.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...ruby 1.6 feature
ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン
になります。
((<stable-snapshot|URL:ftp://ftp.netlab.co.jp/pub/lang/ruby/stable-snapshot.tar.gz>)) は、日々更新される安定版の最新ソースです。
== 1.6.8 (2002-12-24) ->......EWOULDBLOCK
=> ruby 1.6.7 (2002-03-01) [i586-linux]
Errno::EAGAIN
Errno::EWOULDBLOCK
=> ruby 1.6.8 (2002-12-24) [i586-linux]
Errno::EAGAIN
-:2: uninitialized constant EWOULDBLOCK at Errno (NameError)
=> ruby 1.6.8 (2003-02-13) [i......。((<ruby-dev:13752>))
: attr_*
アクセサに余計な引数を渡してもエラーになりませんでした。
((<ruby-dev:13748>))
class C
def initialize
@message = 'ok'
end
attr_reader :message
end
puts C.new.message(1,2,3)
=> ruby 1.6.4 (20... -
ruby 1
. 9 feature (3847.0) -
ruby 1.9 feature ruby version 1.9.0 は開発版です。 以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。 1.9.1 以降は安定版です。 バグ修正がメインになります。
...ruby 1.9 feature
ruby version 1.9.0 は開発版です。
以下にあげる機能は将来削除されたり互換性のない仕様変更がなされるかもしれません。
1.9.1 以降は安定版です。
バグ修正がメインになります。
記号について(特に重要なもの......は大文字(主観))
* カテゴリ
* [ruby]: ruby インタプリタの変更
* [api]: 拡張ライブラリ API
* [lib]: ライブラリ
* [parser]: 文法の変更
* [regexp]: 正規表現の機能拡張
* [marshal]: Marshal ファイルのフォーマット変更
* レベル
* [b......なり、attr_reader 相当になりました
[RCR#331]
=== 2006-06-22
: Module#name
無名モジュールに対しては nil を返すようになりました
[ruby-talk:198440]
=== 2006-06-17
: BasicObject#invoke_method
: BasicObject#invoke_functional_method
追加
((<ruby-talk:197... -
NEWS for Ruby 3
. 1 . 0 (3243.0) -
NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 3.1.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......。単一代入では、Rubyは左から右への評価順序を使用します。このコードでは、
//emlist[][ruby]{
foo[0] = bar
//}
* 次の評価順序になります。
//emlist{
1. `foo`
2. `bar`
3. `[]=` called on the result of `foo`
//}
* Ruby 3.1.0より前は、多重......https://github.com/ruby/rbs/pull/844
//emlist{
# `T` must be compatible with the `_Output` interface.
# `PrettyPrint[String]` is ok, but `PrettyPrint[Integer]` is a type error.
class PrettyPrint[T < _Output]
interface _Output
def <<: (String) -> void
end
attr_reader output: T
def ini... -
NEWS for Ruby 3
. 0 . 0 (3195.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 3.0.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now matches the behavior of Procs
accepting a single rest argument and no keywords.
16166
//emlist[][ruby]{......mes. 17314
* Module#attr_accessor, Module#attr_reader, Module#attr_writer and Module#attr methods now return an array of defined method names as symbols. 17314
* Module#alias_method now returns the defined alias as a symbol. 17314
//emlist[][ruby]{
class C; end
module M1; end
module M2; end... -
NEWS for Ruby 2
. 5 . 0 (3141.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...NEWS for Ruby 2.5.0
このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
それぞれのエントリーは参照情報があるため短いです。
十分な情報と共に書かれた全ての変更のリス......トは ChangeLog ファイルか bugs.ruby-lang.org の issue を参照してください。
== 2.4.0 以降の変更
=== 言語仕様の変更
* トップレベルの定数参照を削除しました 11547
* do/end ブロック内部で rescue/else/ensure を書けるようになりまし......* Method#=== は Proc#===と同じようにMethod#callを呼び出します 14142
* Module
* Module#attr, Module#attr_accessor, Module#attr_reader, Module#attr_writer はパブリックメソッドになりました 14132
* Module#define_method, Module#alias_method, Module#undef_method... -
WIN32OLE
_ TYPE # default _ event _ sources -> [WIN32OLE _ TYPE] (42.0) -
型が持つソースインターフェイスを取得します。
...rer')
ctl = WIN32OLE.new(type.progid)
source = type.default_event_sources[0]
class WebEvent
def initialize
@completed = false
end
attr_reader :completed
end
source.ole_methods.each do |m|
WebEvent.module_eval do
define_method("on#{m.name}") do |*arg|
if arg[0] == "......now}: #{m.name} was called"
p arg
end
end
end
evt = WIN32OLE_EVENT.new(ctl)
evt.handler = WebEvent.new
ctl.navigate2 'http://www.ruby-lang.org/'
loop do
break if evt.handler.completed
WIN32OLE_EVENT.message_loop
end
ctl.Quit
このプログラムを実行するとWindows......e was called
["{265b75c1-4158-11d0-90f6-00c04fd497ea}"]
2010-10-06 22:33:54 +0900: BeforeNavigate2 was called
[#<WIN32OLE:0x9d08f0>, "http://www.ruby-lang.org/", 0, "", nil, "", false]
2010-10-06 22:33:54 +0900: DownloadBegin was called
[]
2010-10-06 22:33:54 +0900: PropertyChange was called... -
BasicObject
# ! -> bool (24.0) -
オブジェクトを真偽値として評価し、その論理否定を返します。
...ても Ruby の制御式において nil や false 以外が偽として
扱われることはありません。
@return オブジェクトが偽であれば真、さもなくば偽
//emlist[例][ruby]{
class NegationRecorder < BasicObject
def initialize
@count = 0
end
attr_reader :count......super
end
end
recorder = NegationRecorder.new
!recorder
!!!!!!!recorder
puts 'hoge' if !recorder
puts recorder.count #=> 3
//}
//emlist[例][ruby]{
class AnotherFalse < BasicObject
def !
true
end
end
another_false = AnotherFalse.new
# another_falseは*真*
puts "another false is a tr... -
ERB
. new(str , safe _ level=NOT _ GIVEN , trim _ mode=NOT _ GIVEN , eoutvar=NOT _ GIVEN , trim _ mode: nil , eoutvar: & # 39; _ erbout& # 39;) -> ERB (24.0) -
eRubyスクリプト から ERB オブジェクトを生成して返します。
...eRubyスクリプト から ERB オブジェクトを生成して返します。
@param str eRubyスクリプトを表す文字列
@param safe_level eRubyスクリプトが実行されるときのセーフレベル
@param trim_mode 整形の挙動を変更するオプション
@param eoutvar eRuby......字列。eRuby スクリプトの中でさらに ERB を使うときに変更
します。通常は指定する必要はありません。
Ruby 2.6.0 から位置引数での safe_level, trim_mode, eoutvar の指定は非推奨です。
Ruby 3.2 で削除されまし......移行してください。
//emlist[例][ruby]{
require "erb"
# build data class
class Listings
PRODUCT = { :name => "Chicken Fried Steak",
:desc => "A well messages pattie, breaded and fried.",
:cost => 9.95 }
attr_reader :product, :price
def initialize( produ... -
ERB
. new(str , safe _ level=nil , trim _ mode=nil , eoutvar=& # 39; _ erbout& # 39;) -> ERB (24.0) -
eRubyスクリプト から ERB オブジェクトを生成して返します。
...eRubyスクリプト から ERB オブジェクトを生成して返します。
@param str eRubyスクリプトを表す文字列
@param safe_level eRubyスクリプトが実行されるときのセーフレベル
@param trim_mode 整形の挙動を変更するオプション
@param eoutvar eRuby......字列。eRuby スクリプトの中でさらに ERB を使うときに変更
します。通常は指定する必要はありません。
Ruby 2.6.0 から位置引数での safe_level, trim_mode, eoutvar の指定は非推奨です。
Ruby 3.2 で削除されまし......移行してください。
//emlist[例][ruby]{
require "erb"
# build data class
class Listings
PRODUCT = { :name => "Chicken Fried Steak",
:desc => "A well messages pattie, breaded and fried.",
:cost => 9.95 }
attr_reader :product, :price
def initialize( produ... -
Object
. yaml _ tag(tag) -> () (24.0) -
クラスと tag の間を関連付けます。
... Ruby のオブジェクトに
変換したりその逆をしたりすることができます。
@param tag 対象のクラスに関連付けるタグの文字列
=== Example
require 'psych'
class Foo
def initialize(x)
@x = x
end
attr_reader :x
end
# Dumps Ruby......object normally
p Psych.dump(Foo.new(3))
# =>
# --- !ruby/object:Foo
# x: 3
# Registers tag with class Foo
Foo.yaml_as("tag:example.com,2013:foo")
# ... and dumps the object of Foo class
Psych.dump(Foo.new(3), STDOUT)
# =>
# --- !<tag:example.com,2013:foo>
# x: 3
#...