るりまサーチ

最速Rubyリファレンスマニュアル検索!
33件ヒット [1-33件を表示] (0.022秒)
トップページ > クエリ:Module[x] > クエリ:attr_accessor[x]

別のキーワード

  1. module attr
  2. _builtin attr
  3. net/imap attr
  4. rdoc attr_modifiers
  5. etc sc_thread_attr_stackaddr

ライブラリ

クラス

検索結果

Module#attr_accessor(*name) -> [Symbol] (39113.0)

インスタンス変数 name に対する読み取りメソッドと書き込みメソッドの両方を 定義します。

...ッドと書き込みメソッドの両方を
定義します。

//emlist[例][ruby]{
class User
attr_accessor
:name # => [:name, :name=]
# 複数の名前を渡すこともできる
attr_accessor
:id, :age # => [:id, :id=, :age, :age=]
end
//}

このメソッドで定義されるメソッ...

Module#attr_accessor(*name) -> nil (39101.0)

インスタンス変数 name に対する読み取りメソッドと書き込みメソッドの両方を 定義します。

インスタンス変数 name に対する読み取りメソッドと書き込みメソッドの両方を
定義します。


このメソッドで定義されるメソッドの定義は以下の通りです。

//emlist[例][ruby]{
def name
@name
end
def name=(val)
@name = val
end
//}

@param name String または Symbol を 1 つ以上指定します。

クラス/メソッドの定義 (124.0)

クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined

...クラス/メソッドの定義
* クラス/メソッドの定義:
* class
* singleton_class
* module
* method
* operator
* nest_method
* eval_method
* singleton_method
* class_method
* limit
* 定義に関する操作:
* alias
* undef
* d...
...うな場合は外側は普通モジュールが利用される
# (Net のインスタンスがない。Net を include できるなどのため)
module
Net
class HTTP
end
class FTP
end
end

obj = Net::HTTP.new

# あるいは

include Net
obj = HTTP.new

# 以下のような使い方は組...
...可能な演算子(例: ==, +, -
など spec/operator を参照)も指定できます(operator参照)。

//emlist[例][ruby]{
class Vector2D
attr_accessor
:x, :y # インスタンス変数@x, @yに対応するゲッタとセッタを定義
def initialize(x, y) # コンストラクタ
@x...

NEWS for Ruby 3.0.0 (102.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...is now a SyntaxError instead of a LocalJumpError. 15575
* When a class variable is overtaken by the same definition in an
ancestor class/module, a RuntimeError is now raised (previously,
it only issued a warning in verbose mode). Additionally, accessing a
class variable from the t...
...* Module
* Module#include and Module#prepend now affect classes and modules that have already included or prepended the receiver, mirroring the behavior if the arguments were included in the receiver before the other modules and classes included or prepended the receiver. 9573
* Module#pu...
...blic, Module#protected, Module#private, Module#public_class_method, Module#private_class_method, toplevel "private" and "public" methods now accept single array argument with a list of method names. 17314
* Module#attr_accessor, Module#attr_reader, Module#attr_writer and Module#attr methods now...

NEWS for Ruby 2.5.0 (60.0)

NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...thod#callを呼び出します 14142

* Module
* Module#attr, Module#attr_accessor, Module#attr_reader, Module#attr_writer はパブリックメソッドになりました 14132
* Module#define_method, Module#alias_method, Module#undef_method, Module#remove_method はパブリックメソ...

絞り込み条件を変える