クラス
-
JSON
:: Parser (22) - Module (11)
- Object (11)
-
RDoc
:: Options (11) -
Thread
:: Backtrace :: Location (44)
キーワード
- Location (11)
-
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 3
. 0 . 0 (4) -
absolute
_ path (11) -
base
_ label (11) -
extra
_ accessor _ flags (11) -
initialize
_ copy (11) - inspect (11)
- new (11)
- parse (11)
-
rb
_ mod _ attr _ accessor (11) -
rdoc
/ parser / ruby (11) -
to
_ s (11) - クラス/メソッドの定義 (11)
検索結果
先頭5件
-
Module
# attr _ accessor(*name) -> [Symbol] (18113.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 (18101.0) -
インスタンス変数 name に対する読み取りメソッドと書き込みメソッドの両方を 定義します。
インスタンス変数 name に対する読み取りメソッドと書き込みメソッドの両方を
定義します。
このメソッドで定義されるメソッドの定義は以下の通りです。
//emlist[例][ruby]{
def name
@name
end
def name=(val)
@name = val
end
//}
@param name String または Symbol を 1 つ以上指定します。 -
static VALUE rb
_ mod _ attr _ accessor(int argc , VALUE *argv , VALUE klass) (6100.0) -
-
JSON
:: Parser # parse -> object (6.0) -
現在のソースをパースして結果を Ruby のオブジェクトとして返します。
...のソースをパースして結果を Ruby のオブジェクトとして返します。
//emlist[例][ruby]{
require 'json'
class Person
attr_accessor :name, :age
def []=(key, value)
instance_variable_set("@#{key}", value)
end
end
parser = JSON::Parser.new(DATA.read, object_class: P... -
JSON
:: Parser . new(source , options => {}) -> JSON :: Parser (6.0) -
パーサを初期化します。
...},
"Suzuki": {
"name":"suzuki",
"age":25
}
}
//}
//emlist[例 object_class を指定する][ruby]{
require 'json'
class Person
attr_accessor :name, :age
def []=(key, value)
instance_variable_set("@#{key}", value)
end
end
parser = JSON::Parser.new(DATA.read, object_class:... -
NEWS for Ruby 2
. 5 . 0 (6.0) -
NEWS for Ruby 2.5.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...12882
* Method
* Method#=== は Proc#===と同じようにMethod#callを呼び出します 14142
* Module
* Module#attr, Module#attr_accessor, Module#attr_reader, Module#attr_writer はパブリックメソッドになりました 14132
* Module#define_method, Module#alias_method... -
NEWS for Ruby 3
. 0 . 0 (6.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...#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 return an array of defined method names as symbols. 17314
* Module#ali... -
Object
# initialize _ copy(obj) -> object (6.0) -
(拡張ライブラリによる) ユーザ定義クラスのオブジェクトコピーの初期化メソッド。
...を作ります。 obj.clone は、さらに
特異メソッドのコピーも行います。
//emlist[][ruby]{
obj = Object.new
class <<obj
attr_accessor :foo
def bar
:bar
end
end
def check(obj)
puts "instance variables: #{obj.inspect}"
puts "tainted?: #{obj.tainted?}"
print "sing......を作ります。 obj.clone は、さらに
特異メソッドのコピーも行います。
//emlist[][ruby]{
obj = Object.new
class <<obj
attr_accessor :foo
def bar
:bar
end
end
def check(obj)
puts "instance variables: #{obj.inspect}"
print "singleton methods: "
begin
p obj.... -
RDoc
:: Options # extra _ accessor _ flags -> {String => String} (6.0) -
コマンドライン引数の --accessor オプションで指定したアクセサがキー、ア クセサの種類が値のハッシュを返します。
...コマンドライン引数の --accessor オプションで指定したアクセサがキー、ア
クセサの種類が値のハッシュを返します。
値は r、w、rw のいずれかです。それぞれ attr_reader、attr_writer、
attr_accessor に対応します。... -
Thread
:: Backtrace :: Location (6.0) -
Ruby のフレームを表すクラスです。
...果:
caller_locations.rb:2:in `a'
caller_locations.rb:5:in `b'
caller_locations.rb:8:in `c'
//emlist[例2][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.to_s
end... -
Thread
:: Backtrace :: Location # absolute _ path -> String (6.0) -
self が表すフレームの絶対パスを返します。
...self が表すフレームの絶対パスを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end
# => /path/to/foo.rb
# /path... -
Thread
:: Backtrace :: Location # base _ label -> String (6.0) -
self が表すフレームの基本ラベルを返します。通常、 Thread::Backtrace::Location#label から修飾を取り除いたもので構成 されます。
...、
Thread::Backtrace::Location#label から修飾を取り除いたもので構成
されます。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.base_lab...