るりまサーチ

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

別のキーワード

  1. fiddle ref
  2. pointer ref
  3. entity ref
  4. _builtin _id2ref
  5. rexml/document ref

検索結果

<< 1 2 > >>

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

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

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

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

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

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

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

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

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

Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (3734.0)

Rubyで使われる記号の意味(正規表現の複雑な記号は除く) ex q num per and or  plus minus ast slash hat sq  period comma langl rangl eq tilde  dollar at under lbrarbra  lbra2rbra2 lbra3rbra3 dq colon ac  backslash semicolon

...式 .. 式

条件式中の範囲式は特別にフリップフロップのように働きます。

//emlist{
'1234543212345'.each_char { |n| print( (n == ?2)..(n == ?4) ? n : '_' ) } #=> _234___21234_
#"2"が出るまではfalse、"2"が出てから"4"が出るまではtrue、"4"から"2"...

リテラル (418.0)

リテラル * num * string * backslash * exp * char * command * here * regexp * array * hash * range * symbol * percent

...
前(符号(+,-)の直後を含む)に _を置くとローカル変数やメソッド呼び
出しと解釈されます)

_ は、0x などの prefix の直後に書くことはできません。また、_ を連続して
書いてもエラーになります。他、細かい部分でこのあた...
...する行指向のリテラルです。例えば、

//emlist[][ruby]{
print
<<EOS # 識別子 EOS までがリテラルになる
the string
next line
EOS
//}

これは以下と同じです。

//emlist[][ruby]{
print
" the string\n next line\n"
//}

ヒアドキュメントでは、開...
...ラベルの次の行は常にヒアドキュメントとなります。例えば、以下のよう
な記述は文法エラーになります

print
f('%s%d',
<<EOS,
3055 * 2 / 5) # <- この行はヒアドキュメントに含まれてしまう
This l...

正規表現 (396.0)

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

...uping
* subexp
* selector
* anchor
* cond
* option
* encoding
* comment
* free_format_mode
* absenceop
* list
* specialvar
* references


正規表現(regular expression)は文字列のパターンを記述するための言語です。
また、この言語で記述された...
...り空白文字、制御文字、以外) ([[:^space:]] && ^Control && ^Unassigned && ^Surrogate)
* [:lower:] 小文字 (Lowercase_Letter)
* [:print:] 表示可能な文字(空白を含む) ([[:graph:]] | Space_Separator)
* [:punct:] 句読点 (Connector_Punctuation | Dash_Punctuation | Close_P...
...=val
print
var
という2つの命令を持つコマンドにマッチするような正規表現です。

//emlist[][ruby]{
re = /\A(?:(set)|(print))\s+(\w+)(?(1)=(\d+))\z/
re.match("set x=32") # => #<MatchData "set x=32" 1:"set" 2:nil 3:"x" 4:"32">
re.match("print x") # => #<MatchData "print x"...

絞り込み条件を変える

制御構造 (324.0)

制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END

...クラス設計者が定義する事が出来るものです.

=== 条件分岐
====[a:if] if

//emlist[例][ruby]{
if age >= 12 then
print
"adult fee\n"
else
print
"child fee\n"
end
gender = if foo.gender == "male" then "male" else "female" end
//}

文法:

if 式 [then]...
...には特別に

//emlist[][ruby]{
$_ =~ リテラル
//}

であるかのように評価されます。

==== if 修飾子

//emlist[例][ruby]{
print
"debug\n" if $DEBUG
//}

文法:

式 if 式

右辺の条件が成立する時に、左辺の式を評価してその結果を返しま...
...then 以下の
式を評価します。unless 式にelsif を指定することはできませ
ん。

==== unless 修飾子

//emlist[例][ruby]{
print
"stop\n" unless valid(passwd)
//}

文法:

式 unless 式

右辺の条件が成立しない時に、左辺の式を評価してその...

クラス/メソッドの定義 (292.0)

クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined

...][ruby]{
def foo(cnt, &block_arg)
cnt.times { block_arg.call } # ブロックに収まったProcオブジェクトはcallで実行
end
foo(3) { print "Ruby! " } #=> Ruby! Ruby! Ruby!
//}

メソッド定義において、仮引数はその種類毎に以下の順序でしか指定すること
...
...ruby]{
foo # <- foo は未定義
def foo
print
"foo\n"
end
//}

は未定義メソッドの呼び出しで例外 NameError を発生させます。

===[a:singleton_method] 特異メソッド定義

//emlist[例][ruby]{
def foo.test
print
"this is foo\n"
end
//}

文法:

def...
...しなくなる可能性があります。

undef 式は nil を返します。

====[a:defined] defined?

//emlist[例][ruby]{
defined? print
defined? File.print
defined?(foobar)
defined?($foobar)
defined?(@foobar)
defined?(Foobar)
//}

文法:

defined? 式

式が定義されていな...

メソッド呼び出し(super・ブロック付き・yield) (174.0)

メソッド呼び出し(super・ブロック付き・yield) * super * block * yield * block_arg * numbered_parameters * call_method

...ield)
* super
* block
* yield
* block_arg
* numbered_parameters
* call_method

//emlist[例][ruby]{
foo.bar()
foo.bar
bar()
print
"hello world\n"
print

Class.new
Class::new
//}

文法:

[式 `.'] 識別子 [`(' [[`*'] 式] ... [`&' 式] `)']
[式 `::'] 識別子 [`...
...end
end
Bar.new.foo 5
//}

===[a:block] ブロック付きメソッド呼び出し

//emlist[例][ruby]{
[1,2,3].each do |i| print i*2, "\n" end
[1,2,3].each {|i| print i*2, "\n" }
//}

文法:

method(arg1, arg2, ...) do [`|' 式 ... `|'] 式 ... end
method(arg1, arg2, ...)...
...の中でだけ有効です。例えば:

//emlist[][ruby]{
foobar {
i = 20 # ローカル変数 `i' が宣言された
# ...
}
print
defined? i # `i' はここでは未定義なので false
foobar a, b do
i = 11 # まったく別の変数 i の宣言
# ....

Rubyの起動 (56.0)

Rubyの起動 * cmd_option * shebang

...はRubyの配列変数($:)に追加されます。

: -l

行末の自動処理を行います。まず、$\ を
$/ と同じ値に設定し, printでの出力
時に改行を付加するようにします。それから, -n
フラグまたは-pフラグが指定されていると
gets...
...該当する引数は
Object::ARGV から取り除かれます。

例:
//emlist{
#! /usr/local/bin/ruby -s
# prints "true" if invoked with `-xyz' switch.
print
"true\n" if $xyz
//}

: -S

スクリプト名が`/'で始まっていない場合, 環境変数
PATHの値を使って...
<< 1 2 > >>