るりまサーチ

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

別のキーワード

  1. kernel $-l
  2. matrix l
  3. _builtin $-l
  4. lupdecomposition l
  5. l matrix

ライブラリ

クラス

モジュール

キーワード

検索結果

Module#extended(obj) -> () (21107.0)

self が他のオブジェクト に Object#extend されたときに 呼ばれます。引数には extend を行ったオブジェクトが渡されます。

...elf が他のオブジェクト に Object#extend されたときに
呼ばれます。引数には extend を行ったオブジェクトが渡されます。

@param obj Object#extend を行ったオブジェクト

//emlist[例][ruby]{
module Foo
def self.extended(obj)
p "#{obj} extend #{sel...
...f}"
end
end

Object.new.extend Foo

# => "#<Object:0x401cbc3c> extend Foo"
//}

@see Module#extend_object...

IRB::HistorySavingAbility.extended(obj) -> object (21101.0)

obj に irb のヒストリの読み込み、保存の機能を提供します。

...obj に irb のヒストリの読み込み、保存の機能を提供します。

obj を返します。

@param obj IRB::HistorySavingAbility を extend したオブジェクトです。...

Regexp.compile(string, option = nil, code = nil) -> Regexp (6112.0)

文字列 string をコンパイルして正規表現オブジェクトを生成して返します。

...す。

@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORE...
...す。

//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
p $~ # => "This is Regexp"

t2 = Regexp.compile('
this # ここは使用されない
\ is
\ regexp # ここも使用されない
', Regexp::EXTENDED | Regexp::IGNOR...
...ECASE)
t2.match(str)
p Regexp.last_match # => "This is Regexp"

str = "ふるいけや\nかわずとびこむ\nみずのおと"
t2 = Regexp.compile("ふる.*?と", Regexp::MULTILINE)
p t2.match(str)[0] # => "ふるいけや\nかわずと"
//}...

Regexp.new(string, option = nil, code = nil) -> Regexp (3112.0)

文字列 string をコンパイルして正規表現オブジェクトを生成して返します。

...す。

@param option Regexp::IGNORECASE, Regexp::MULTILINE,
Regexp::EXTENDED
の論理和を指定します。
Integer 以外であれば真偽値の指定として見なされ
、真(nil, false 以外)であれば
Regexp::IGNORE...
...す。

//emlist[例][ruby]{
str = "This is Regexp"
t1 = Regexp.compile("this is regexp", Regexp::IGNORECASE)
t1.match(str)
p $~ # => "This is Regexp"

t2 = Regexp.compile('
this # ここは使用されない
\ is
\ regexp # ここも使用されない
', Regexp::EXTENDED | Regexp::IGNOR...
...ECASE)
t2.match(str)
p Regexp.last_match # => "This is Regexp"

str = "ふるいけや\nかわずとびこむ\nみずのおと"
t2 = Regexp.compile("ふる.*?と", Regexp::MULTILINE)
p t2.match(str)[0] # => "ふるいけや\nかわずと"
//}...

Module#extend_object(obj) -> object (3018.0)

Object#extend の実体です。オブジェクトにモジュールの機能を追加します。

...

//emlist[例][ruby]{
def extend(*modules)
modules.reverse_each do |mod|
# extend_object や extended はプライベートメソッドなので
# 直接 mod.extend_object(self) などとは書けない
mod.__send__(:extend_object, self)
mod.__send__(:extended, self)
end
end...
...では、self に定義されて
いるインスタンスメソッドを obj の特異メソッドとして追加します。

@param obj self の機能を追加するオブジェクトを指定します。

@return obj で指定されたオブジェクトを返します。

@see Module#extended...

絞り込み条件を変える

Time#strftime(format) -> String (126.0)

時刻を format 文字列に従って文字列に変換した結果を返します。

...の時(01-12)
* %j: 年中の通算日(001-366)
* %k: 24時間制の時。一桁の場合、半角空白で埋める ( 0..23)
* %L: ミリ秒 (000..999)
* %l: 12時間制の時。一桁の場合、半角空白で埋める ( 0..12)
* %M: 分(00-59)
* %m: 月を表す数字(01-12)
* %n:...
...式 (%a %b %e %H:%M:%S %Z %Y) (Time#strftime は対応していませんが、Date#strftime で使えます)

このメソッドは strftime(3) や glibcの仕様を参考に作成されており、以下のオプションが利用できます。
* ^: 大文字で出力を行なう
* #: 小文...
...=> "at 04:05am"
//}

//emlist[様々なISO 8601形式][ruby]{
t = Time.new(2001,2,3,4,5,6,"+09:00")
p t.strftime("%Y%m%d") # => 20010203 Calendar date (basic)
p t.strftime("%F") # => 2001-02-03 Calendar date (extended)
p t.strftime("%Y-%m")...

Object#extend(*modules) -> self (112.0)

引数で指定したモジュールのインスタンスメソッドを self の特異 メソッドとして追加します。

...引数で指定したモジュールのインスタンスメソッドを self の特異
メソッドとして追加します。

Module#include は、クラス(のインスタンス)に機能を追加します
が、extend は、ある特定のオブジェクトだけにモジュールの機能を...
...ules モジュールを任意個指定します(クラスは不可)。
@return self を返します。

//emlist[][ruby]{
module Foo
def a
'ok Foo'
end
end

module Bar
def b
'ok Bar'
end
end

obj = Object.new
obj.extend Foo, Bar
p obj.a #=> "ok Foo"
p obj.b #=> "ok Bar"

class Kl...
...nclude Foo
extend Bar
end

p Klass.new.a #=> "ok Foo"
p Klass.b #=> "ok Bar"
//}

extend の機能は、「特異クラスに対する Module#include」
と言い替えることもできます。
ただしその場合、フック用のメソッド
が Module#extended ではなく Module#includ...

正規表現 (36.0)

正規表現 * metachar * expansion * char * anychar * string * str * quantifier * capture * grouping * subexp * selector * anchor * cond * option * encoding * comment * free_format_mode * absenceop * list * specialvar * references

...string
* str
* quantifier
* capture
* grouping
* subexp
* selector
* anchor
* cond
* option
* encoding
* comment
* free_format_mode
* absenceop
* list
* specialvar
* references


正規表現(regular expression)は文字列のパターンを記述するための言語...
...るかどうかを判定し、
また含んでいるならばそれが文字列中のどの場所であるかを知ることができます。

//emlist[][ruby]{
/pat/
%r{pat}
//}

などの正規表現リテラルや Regexp.new などで正規表現
オブジェクトを得ることができます...
...u{2028}\u{2029}]) (Unicode 以外では (?>\x0D\x0A|[\x0A-\x0D]) になります)
* \X Unicode 結合文字シーケンス (eXtended grapheme cluster) (?>\P{M}\p{M}*)

//emlist[][ruby]{
# \u{0308} はウムラウト
/\X/.match("e\u{0308}") # => #<MatchData "ë">
$&.codepoints # => [101, 776]
/\w/...