るりまサーチ

最速Rubyリファレンスマニュアル検索!
48件ヒット [1-48件を表示] (0.023秒)
トップページ > クエリ:kernel[x] > クエリ:open[x] > クエリ:print[x] > 種類:文書[x]

別のキーワード

  1. kernel spawn
  2. kernel exec
  3. kernel system
  4. kernel open
  5. kernel fail

検索結果

制御構造 (121.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 式

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

NEWS for Ruby 3.0.0 (103.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...wait(io, events, timeout)` in a non-blocking execution context. 16786
* Kernel
* Kernel#clone when called with the `freeze: false` keyword will call `#initialize_clone` with the `freeze: false` keyword. 14266
* Kernel#clone when called with the `freeze: true` keyword will call `#initialize...
...s unfrozen. 16175
* Kernel#eval when called with two arguments will use `"(eval)"` for `__FILE__` and `1` for `__LINE__` in the evaluated code. 4352
* Kernel#lambda now warns if called without a literal block. 15973
* Kernel.sleep invokes the scheduler hook `#kernel_sleep(...)` in a non-...
...s as a symbol. 17314

//emlist[][ruby]{
class C; end
module M1; end
module M2; end
C.include M1
M1.include M2
p C.ancestors #=> [C, M1, M2, Object, Kernel, BasicObject]
//}

* Mutex
* `Mutex` is now acquired per-`Fiber` instead of per-`Thread`. This change should be compatible for essentially...

ruby 1.6 feature (67.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...1.6.7 (2002-07-30) [i586-linux]

: 2002-06-03 sprintf()

"%d" で引数を整数にするときに、((<組み込み関数/Integer>)) と同じ規則を
使用するようになりました。

p sprintf("%d", nil)

=> -:1:in `sprintf': no implicit conversion from nil (TypeError)...
...dev:17155>))

open
("|-","r+") {|f|
if f
f.dup.close_write
else
sleep 1
end
}

=> ruby 1.6.7 (2002-03-01) [i586-linux]
-:3:in `close_write': closing non-duplex IO for writing (IOError)
from -:3
from -:1:in `open'...
...ルシステムでこ
のような場合があります)が File#read などで読めないバグが修正されまし
た。

p File.open("/proc/#$$/cmdline").read

=> ruby 1.6.7 (2002-03-01) [i586-linux]
""

=> ruby 1.6.7 (2002-03-29) [i586-linux]...

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

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

...Y = 0
WRONLY = 1
end
include Constants
end

File.open("foo", File::RDONLY)

# あるいは

include File::Constants
File.open("foo", RDONLY)

# 上記はあくまでも例である。実際の File.open ではより簡便な
# File.open("foo", "r") という形式が使われる
//}

クラ...
...タを定義する方法の一つです。イテレータを定義する代表的な方法は
yield を呼び出すことです。
他に Proc.new/Kernel.#proc を使う方法などもあります。
ブロックが与えられなかった場合のブロック引数の値はnilです。

//emlist[...
...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...

ruby 1.8.5 feature (19.0)

ruby 1.8.5 feature ruby 1.8.4 から ruby 1.8.5 までの変更点です。

...8

: BasicSocket#recv_nonblock [new]
: UDPSocket#recvfrom_nonblock [new]

追加

=== 2006-06-17

: Pathname(path) [new]

pathname で追加

: Kernel#pretty_inspect [new]

pp で追加

: RSS::TaxonomyTopicModel [new]
: RSS::TaxonomyTopicsModel [new]
: RSS::Maker::TaxonomyTopicModel [new]
: R...
...こんな風にすると、RSS 1.0からRSS 2.0に変換できます。

rss10 = RSS::Parser.parse(File.read("1.0.rdf"))
File.open("2.0.rss", "w") {|f| f.print(rss10.to_xml("2.0"))}

((<ruby-talk:197284>))

: RSS::VERSION

"0.1.5"から"0.1.6"になりました。

=== 2006-06-14

: Pro...

絞り込み条件を変える