るりまサーチ

最速Rubyリファレンスマニュアル検索!
92件ヒット [1-92件を表示] (0.048秒)
トップページ > クエリ:p[x] > クエリ:append[x] > ライブラリ:ビルトイン[x]

別のキーワード

  1. openssl p
  2. openssl p=
  3. fileutils mkdir_p
  4. rsa p
  5. kernel p

クラス

モジュール

キーワード

検索結果

Array#append(*obj) -> self (24209.0)

指定された obj を順番に配列の末尾に追加します。 引数を指定しなければ何もしません。

...なければ何もしません。

@param obj 自身に追加したいオブジェクトを指定します。

//emlist[例][ruby]{
array = [1, 2, 3]
array.push 4
array.push [5, 6]
array.push 7, 8
p
array # => [1, 2, 3, 4, [5, 6], 7, 8]
//}

@see Array#pop, Array#shift, Array#unshift, Array...

Module#append_features(module_or_class) -> self (12221.0)

モジュール(あるいはクラス)に self の機能を追加します。

...][ruby]{
def include(*modules)
modules.reverse_each do |mod|
# append_features や included はプライベートメソッドなので
# 直接 mod.append_features(self) などとは書けない
mod.__send__(:append_features, self)
mod.__send__(:included, self)
end
end
//}

@see...

String#append_as_bytes(*objects) -> self (12221.0)

引数で与えたオブジェクトをバイト列として、self に破壊的に連結します。

...SCII-8BIT)>
s.append_as_bytes("い") # => "\xE3\x81\x82\xE3\x81\x84"

# s << "い" では連結できない
s << "い" # => "incompatible character encodings: BINARY (ASCII-8BIT) and UTF-8 (Encoding::CompatibilityError)
//}

//emlist[引数で整数を渡す例][ruby]{
t = ""
t.append_as_bytes(0x6...
...1) # => "a"
t.append_as_bytes(0x3062) # => "ab"
//}

@see String#<<, String#concat...

File::Constants::APPEND -> Integer (12203.0)

追記モードでファイルを開くときに指定します。 File.openで使用します。

...追記モードでファイルを開くときに指定します。
File.openで使用します。...

Array#push(*obj) -> self (9109.0)

指定された obj を順番に配列の末尾に追加します。 引数を指定しなければ何もしません。

...なければ何もしません。

@param obj 自身に追加したいオブジェクトを指定します。

//emlist[例][ruby]{
array = [1, 2, 3]
array.push 4
array.push [5, 6]
array.push 7, 8
p
array # => [1, 2, 3, 4, [5, 6], 7, 8]
//}

@see Array#pop, Array#shift, Array#unshift, Array...

絞り込み条件を変える

Kernel.#open(file, mode_enc = "r", perm = 0666) -> IO (6208.0)

file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。

...である時、open は Ruby の子プロセス
を生成し、その子プロセスとの間のパイプ(IOオブジェクト)を返し
ます。(このときの動作は、IO.popen と同じです。
File.open にはパイプラインを生成する機能はありません)。

P
erlと異なり...
...ます。

@param file ファイルを文字列で指定します。整数を指定した場合はファイルディスクリプタとして扱います。
@param mode_enc モード・エンコーディングを文字列か定数の論理和で指定します。後述。
@param perm open(2) の第 3...
...ョンを整数で指定します。
@raise Errno::EXXX ファイルのオープンに失敗した場合に発生します。


@see File.open,IO.popen,IO.open

=== 第二引数のオープンモード・エンコーディング
文字列("mode" か "mode:ext_enc" か "mode:ext_enc:int_enc" とい...

Kernel.#open(file, mode_enc = "r", perm = 0666) {|io| ... } -> object (6208.0)

file をオープンして、IO(Fileを含む)クラスのインスタンスを返します。

...である時、open は Ruby の子プロセス
を生成し、その子プロセスとの間のパイプ(IOオブジェクト)を返し
ます。(このときの動作は、IO.popen と同じです。
File.open にはパイプラインを生成する機能はありません)。

P
erlと異なり...
...ます。

@param file ファイルを文字列で指定します。整数を指定した場合はファイルディスクリプタとして扱います。
@param mode_enc モード・エンコーディングを文字列か定数の論理和で指定します。後述。
@param perm open(2) の第 3...
...ョンを整数で指定します。
@raise Errno::EXXX ファイルのオープンに失敗した場合に発生します。


@see File.open,IO.popen,IO.open

=== 第二引数のオープンモード・エンコーディング
文字列("mode" か "mode:ext_enc" か "mode:ext_enc:int_enc" とい...

String#concat(*arguments) -> self (29.0)

self に複数の文字列を破壊的に連結します。

...ます。

@param arguments 複数の文字列もしくは 0 以上の整数

//emlist[例][ruby]{
str = "foo"
str.concat
p
str # => "foo"

str = "foo"
str.concat "bar", "baz"
p
str # => "foobarbaz"

str = "foo"
str.concat("!", 33, 33)
p
str # => "foo!!!"
//}

@see String#append_as_bytes...

String#<<(other) -> self (24.0)

self に文字列 other を破壊的に連結します。 other が 整数である場合は other.chr(self.encoding) 相当の文字を末尾に追加します。

...追加します。

self を返します。

@param other 文字列もしくは 0 以上の整数

//emlist[例][ruby]{
str = "string"
str.concat "XXX"
p
str # => "stringXXX"

str << "YYY"
p
str # => "stringXXXYYY"

str << 65 # 文字AのASCIIコード
p
str # => "stringXXXYYYA"
//}...

String#concat(other) -> self (24.0)

self に文字列 other を破壊的に連結します。 other が 整数である場合は other.chr(self.encoding) 相当の文字を末尾に追加します。

...追加します。

self を返します。

@param other 文字列もしくは 0 以上の整数

//emlist[例][ruby]{
str = "string"
str.concat "XXX"
p
str # => "stringXXX"

str << "YYY"
p
str # => "stringXXXYYY"

str << 65 # 文字AのASCIIコード
p
str # => "stringXXXYYYA"
//}...

絞り込み条件を変える

Module#include(*mod) -> self (20.0)

モジュール mod をインクルードします。

...モジュール mod をインクルードします。

@param mod Module のインスタンス( Enumerable など)を指定します。

@raise ArgumentError 継承関係が循環してしまうような include を行った場合に発生します。

//emlist[例][ruby]{
module M
end
module M2...
...include M
end
module M
include M2
end
//}

実行結果:

-:3:in `append_features': cyclic include detected (ArgumentError)
from -:3:in `include'
from -:3


インクルードとは、指定されたモジュールの定義
(メソッド、定数) を引き継ぐことです...
...多重継承の代わりに用いられており、 mix-in とも呼びます。

//emlist[例][ruby]{
class C
include FileTest
include Math
end

p
C.ancestors

# => [C, Math, FileTest, Object, Kernel]
//}

モジュールの機能追加は、クラスの継承関係の間にそのモジュー...

Module#included(class_or_module) -> () (14.0)

self が Module#include されたときに対象のクラスまたはモジュー ルを引数にしてインタプリタがこのメソッドを呼び出します。

...このメソッドを呼び出します。

@param class_or_module Module#include を実行したオブジェクト

//emlist[例][ruby]{
module Foo
def self.included(mod)
p
"#{mod} include #{self}"
end
end
class Bar
include Foo
end
# => "Bar include Foo"
//}

@see Module#append_features...