るりまサーチ

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

別のキーワード

  1. etc sc_xopen_enh_i18n
  2. openssl n=
  3. rsa n=
  4. openssl n
  5. rsa n

ライブラリ

クラス

モジュール

検索結果

<< 1 2 > >>

ARGF.class#print(*arg) -> nil (27208.0)

引数を順に処理対象のファイルに出力します。

...引数を順に処理対象のファイルに出力します。

c:ARGF#inplace時にのみ使用できます。
また $stdout への代入の影響を受けません。
それ以外は Kernel.#print と同じです。

@param arg 出力するオブジェクトを任意個指定します。...

ARGF.class#printf(format, *arg) -> nil (15201.0)

C 言語の printf と同じように、format に従い引数を 文字列に変換して処理対象のファイルに出力します。

... printf と同じように、format に従い引数を
文字列に変換して処理対象のファイルに出力します。

c:ARGF#inplace時にのみ使用できます。
また $stdout への代入の影響を受けません。
それ以外は出力先を指定しない形式の Kernel.#print...

Object#pretty_print_cycle(pp) -> () (12236.0)

プリティプリント時にオブジェクトの循環参照が検出された場合、 Object#pretty_print の代わりに呼ばれるメソッドです。

...t#pretty_print の代わりに呼ばれるメソッドです。

あるクラスの pp の出力をカスタマイズしたい場合は、
このメソッドも再定義する必要があります。

@param pp PP オブジェクトです。

//emlist[][ruby]{
class
Array
def pretty_print_cycle(q)...
...q.text(empty? ? '[]' : '[...]')
end
end
//}

@see Object#pretty_print...

Object#pretty_print(pp) -> () (12232.0)

PP.pp や Kernel.#pp がオブジェクトの内容を出力するときに 呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。

...nel.#pp がオブジェクトの内容を出力するときに
呼ばれるメソッドです。PP オブジェクト pp を引数として呼ばれます。

あるクラスの pp の出力をカスタマイズしたい場合は、このメソッドを再定義します。
そのとき pretty_print...
...ty_print メソッドを定義しています。

@param pp PP オブジェクトです。

//emlist[][ruby]{
require 'pp'

class
Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
end
//}

@see Object#pretty_print_cycle, Object#inspe...
...ct, PrettyPrint#text, PrettyPrint#group, PrettyPrint#breakable...
..._print メソッドを定義しています。

@param pp PP オブジェクトです。

//emlist[][ruby]{
class
Array
def pretty_print(q)
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
}
}
end
end
//}

@see Object#pretty_print_cycle, Object#inspect, PrettyPrint#...
...text, PrettyPrint#group, PrettyPrint#breakable...

ARGF.class#inplace_mode -> String | nil (9125.0)

c:ARGF#inplace で書き換えるファイルのバックアップに付加される拡 張子を返します。拡張子が設定されていない場合は空文字列を返します。イン プレースモードでない場合は nil を返します。

...c:ARGF#inplace で書き換えるファイルのバックアップに付加される拡
張子を返します。拡張子が設定されていない場合は空文字列を返します。イン
プレースモードでない場合は nil を返します。

Ruby 起動時の -i オプション や...
...ARGF.class#inplace_mode= で設定します。

例:
# $ echo "test" > test.txt
# $ ruby -i.bak test.rb test.txt
# $ cat test.txt # => "TEST"
# $ cat test.txt.bak # => "test"

# test.rb
ARGF.inplace_mode # => ".bak"
ARGF.each_line {|e|print e.upcase} # => "TEST"

...
...:
# $ echo "test" > test.txt
# $ ruby test.rb test.txt
# $ cat test.txt # => "test"

# test.rb
ARGF.inplace_mode # => nil
ARGF.each_line {|e|print e.upcase} # => "TEST"

@see d:spec/rubycmd#cmd_option, ARGF.class#inplace_mode=...

絞り込み条件を変える

ARGF.class#inplace_mode=(ext) (9125.0)

c:ARGF#inplace時にバックアップファイルに付加する拡張子を設定します。 ピリオドも含めて指定する必要があります。

...c:ARGF#inplace時にバックアップファイルに付加する拡張子を設定します。
ピリオドも含めて指定する必要があります。

バックアップを残さない場合は空文字列を指定します。
この機能は Windows では使用出来ません。

設定が...
...える
ARGF.inplace_mode = '.bak'
ARGF.lines do |line|
print
line.sub("foo","bar")
end


---- -i オプションを使う場合 ----
$ ruby -i.bak -p -e '$_.sub!("foo","bar")' file.txt

---- -i オプションを使う場合その2 ----
$ ruby -i.bak -n -e 'print $_.sub("foo","ba...
...r")' file.txt

@see d:spec/rubycmd#cmd_option, ARGF.class#inplace_mode...

ARGF.class#each_codepoint -> Enumerator (9119.0)

self の各コードポイントに対して繰り返しブロックを呼びだします。

...た場合には、Enumerator を返します。

例:
# $ echo "line1\n" > test1.txt
# $ echo "line2\n" > test2.txt
# $ ruby test.rb test1.txt test2.txt

# test.rb
ARGF.each_codepoint # => #<Enumerator: ARGF:each_codepoint>
ARGF.each_codepoint{|e|print e, ","} # => 108,1...

ARGF.class#each_codepoint { |c| ... } -> self (9119.0)

self の各コードポイントに対して繰り返しブロックを呼びだします。

...た場合には、Enumerator を返します。

例:
# $ echo "line1\n" > test1.txt
# $ echo "line2\n" > test2.txt
# $ ruby test.rb test1.txt test2.txt

# test.rb
ARGF.each_codepoint # => #<Enumerator: ARGF:each_codepoint>
ARGF.each_codepoint{|e|print e, ","} # => 108,1...

ERB#def_class(superklass=Object, methodname=&#39;erb&#39;) -> Class (6321.0)

変換した Ruby スクリプトをメソッドとして定義した無名のクラスを返します。

...thodname メソッド名

//emlist[例][ruby]{
require 'erb'

class
MyClass_
def initialize(arg1, arg2)
@arg1 = arg1; @arg2 = arg2
end
end
filename = 'example.rhtml' # @arg1 と @arg2 が使われている example.rhtml

erb = ERB.new(File.read(filename))
erb.filename = filename
MyClass =...
...erb.def_class(MyClass_, 'render()')
print
MyClass.new('foo', 123).render()

# => test1foo
# test2123
//}...

Module#instance_method(name) -> UnboundMethod (6137.0)

self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。

...スメソッド name をオブジェクト化した UnboundMethod を返します。

@param name メソッド名を Symbol または String で指定します。

@raise NameError self に存在しないメソッドを指定した場合に発生します。

@see Module#public_instance_method, Obje...
...y]{
class
Interpreter
def do_a() print "there, "; end
def do_d() print "Hello "; end
def do_e() print "!\n"; end
def do_v() print "Dave"; end
Dispatcher = {
"a" => instance_method(:do_a),
"d" => instance_method(:do_d),
"e" => instance_method(:do_e),
"v" => instance_...
...method(:do_v)
}
def interpret(string)
string.each_char {|b| Dispatcher[b].bind(self).call }
end
end

interpreter = Interpreter.new
interpreter.interpret('dave')
# => Hello there, Dave!
//}...

絞り込み条件を変える

<< 1 2 > >>