480件ヒット
[1-100件を表示]
(0.025秒)
ライブラリ
- ビルトイン (270)
-
mutex
_ m (12) - rake (12)
-
win32
/ registry (12) - win32ole (12)
クラス
- BasicObject (12)
- Data (6)
- Method (12)
- Module (144)
- Object (36)
- Proc (12)
- TracePoint (12)
-
WIN32OLE
_ TYPE (12) -
Win32
:: Registry :: PredefinedKey (12)
モジュール
-
Mutex
_ m (12) - ObjectSpace (36)
-
Rake
:: TaskManager (12)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 1 . 0 (12) -
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 2
. 5 . 0 (8) - Ruby用語集 (12)
- class (12)
-
class
_ exec (12) -
class
_ variable _ defined? (12) -
const
_ defined? (12) -
default
_ event _ sources (12) -
define
_ aliases (12) -
define
_ finalizer (24) -
define
_ method (24) -
define
_ singleton _ method (24) -
define
_ task (12) -
defined
_ class (12) -
instance
_ variable _ defined? (12) - lambda? (12)
-
method
_ added (12) -
method
_ defined? (12) -
method
_ undefined (12) -
module
_ exec (12) - parameters (12)
-
private
_ method _ defined? (12) -
protected
_ method _ defined? (12) -
public
_ method _ defined? (12) -
rb
_ catch (12) -
rb
_ define _ class (12) -
rb
_ define _ class _ id (12) -
rb
_ define _ class _ under (12) -
rb
_ define _ class _ variable (12) -
rdoc
/ parser / c (12) -
ruby 1
. 6 feature (12) -
singleton
_ method _ undefined (12) -
undefine
_ finalizer (12) - リテラル (12)
検索結果
先頭5件
-
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 で
定義します。既に同名の変数が定義されていたら警告します。 -
Win32
:: Registry :: PredefinedKey # class (9101.0) -
@todo
@todo -
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) # =>...