るりまサーチ

最速Rubyリファレンスマニュアル検索!
438件ヒット [1-100件を表示] (0.031秒)

別のキーワード

  1. _builtin define_method
  2. rake define_task
  3. mutex_m define_aliases
  4. main define_method
  5. module define_method

検索結果

<< 1 2 3 ... > >>

Win32::Registry::PredefinedKey#class (21101.0)

@todo

@todo

Data.define(*args) {|subclass| block } -> Class (18352.0)

Data クラスに新しいサブクラスを作って、それを返します。

...れています。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
p fred.name # => "Fred"
p fred.age # => 5
//}

メンバの値を書き換えることはできません。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
fred.age = 6 #...
...も定義可能です。
以下のように、パターンマッチに利用できます。

//emlist[例][ruby]{
class
HTTPFetcher
Response = Data.define(:body)
NotFound = Data.define

def get(url)
# ダミーの実装
if url == "http://example.com/"
Response.new(body: "Current...
...指定した場合

Data.define にブロックを指定した場合は定義した Data をコンテキストにブロックを評価します。
また、定義した Data はブロックパラメータにも渡されます。

//emlist[例][ruby]{
Customer = Data.define(:name, :address) do
def...

Data.define(*args) -> Class (18252.0)

Data クラスに新しいサブクラスを作って、それを返します。

...れています。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
p fred.name # => "Fred"
p fred.age # => 5
//}

メンバの値を書き換えることはできません。

//emlist[例][ruby]{
Dog = Data.define(:name, :age)
fred = Dog.new("Fred", 5)
fred.age = 6 #...
...も定義可能です。
以下のように、パターンマッチに利用できます。

//emlist[例][ruby]{
class
HTTPFetcher
Response = Data.define(:body)
NotFound = Data.define

def get(url)
# ダミーの実装
if url == "http://example.com/"
Response.new(body: "Current...
...指定した場合

Data.define にブロックを指定した場合は定義した Data をコンテキストにブロックを評価します。
また、定義した Data はブロックパラメータにも渡されます。

//emlist[例][ruby]{
Customer = Data.define(:name, :address) do
def...

TracePoint#defined_class -> Class | module (12350.0)

メソッドを定義したクラスかモジュールを返します。

...メソッドを定義したクラスかモジュールを返します。

//emlist[例][ruby]{
class
C; def foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => C
end.enable do
C.new.foo
end
//}

メソッドがモジュールで定義されていた場合も(include に...
...//emlist[例][ruby]{
module M; def foo; end; end
class
C; include M; end;
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => M
end.enable do
C.new.foo
end
//}

[注意] 特異メソッドを実行した場合は TracePoint#defined_class は特異クラ
スを返します。また、K...
...ラメータは特異クラスではなく元のクラスを返します。

//emlist[例][ruby]{
class
C; def self.foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => #<Class:C>
end.enable do
C.foo
end
//}

Kernel.#set_trace_func と TracePoint の上記の差分に注...

Module#class_variable_defined?(name) -> bool (12231.0)

name で与えられた名前のクラス変数がモジュールに存在する場合 true を 返します。

...name Symbol か String を指定します。

//emlist[例][ruby]{
class
Fred
@@foo = 99
end
Fred.class_variable_defined?(:@@foo) #=> true
Fred.class_variable_defined?(:@@bar) #=> false
Fred.class_variable_defined?('@@foo') #=> true
Fred.class_variable_defined?('@@bar') #=> false
//}...

絞り込み条件を変える

VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super) (12206.0)

super のサブクラスとして新しい Ruby クラスを、outer の定数として定義し て返します。

...属するクラス

@param name クラス名

@param super 継承元のクラス。NULL を指定した場合は Object クラス

@raise TypeError 引数 name と同じ名前の定数が既に存在し、それが
Class
オブジェクトではない場合に発生します。...
...ス。NULL を指定した場合は Object クラス

@raise TypeError 引数 name と同じ名前の定数が既に存在し、それが
Class
オブジェクトではない場合に発生します。

@raise TypeError 定義済みのクラスと継承元のクラスが一致しな...

VALUE rb_define_class(const char *name, VALUE super) (12200.0)

クラス super の下位クラス name を作成し返します。

クラス super の下位クラス name を作成し返します。

VALUE rb_define_class_id(ID id, VALUE super) (12200.0)

クラス名 id でクラス super を継承したクラスを 新しく作成する。クラス→クラス名 (定数名) の関連付けは なされるが、定数→クラスの関連付けはなされない。

クラス名 id でクラス super を継承したクラスを
新しく作成する。クラス→クラス名 (定数名) の関連付けは
なされるが、定数→クラスの関連付けはなされない。

void rb_define_class_variable(VALUE klass, const char *name, VALUE val) (12200.0)

クラス klass のクラス変数 name を初期値 val で 定義します。既に同名の変数が定義されていたら警告します。

クラス klass のクラス変数 name を初期値 val で
定義します。既に同名の変数が定義されていたら警告します。

Rake::TaskManager#define_task(task_class, *args) { ... } -> Rake::Task (6214.0)

タスクを定義します。

...します。

@param task_class タスククラスを指定します。

@param args タスクに渡すパラメータを指定します。

//emlist[][ruby]{
# Rakefile での記載例とする

task default: :test_rake_app
task :test_rake_app do
Rake.application.define_task(Rake::Task, :t) # =>...

絞り込み条件を変える

Mutex_m.define_aliases(klass) -> Class (6202.0)

ユーザが直接、使うことはありません。

ユーザが直接、使うことはありません。
<< 1 2 3 ... > >>