クラス
- CSV (44)
- IO (11)
- Object (11)
-
Zlib
:: GzipWriter (22)
モジュール
- Enumerable (11)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - DATA (11)
-
NEWS for Ruby 3
. 0 . 0 (4) - NKF (11)
- Open3 (11)
- bigdecimal (11)
- chunk (11)
- irb (11)
- open (44)
- printf (11)
- rake (11)
- rss (11)
-
ruby 1
. 6 feature (11) -
ruby 1
. 8 . 3 feature (11) -
ruby 1
. 8 . 5 feature (11) - sysseek (11)
- クラス/メソッドの定義 (11)
- 制御構造 (11)
検索結果
先頭5件
-
Zlib
:: GzipWriter # print(*str) -> nil (18231.0) -
引数を自身に順に出力します。引数を省略した場合は、$_ を出力します。
...トを指定します。
require 'zlib'
filename='hoge1.gz'
fw = File.open(filename, "w")
Zlib::GzipWriter.wrap(fw, Zlib::BEST_COMPRESSION){|gz|
gz.print "ugo"
}
fr = File.open(filename)
Zlib::GzipReader.wrap(fr){|gz|
puts gz.read
}
#=> ugo
@see IO#print, Kernel.#print... -
Zlib
:: GzipWriter # printf(format , *args) -> nil (6219.0) -
C 言語の printf と同じように、format に従い引数 を文字列に変換して、自身に出力します。
...C 言語の printf と同じように、format に従い引数
を文字列に変換して、自身に出力します。
@param format フォーマット文字列を指定します。print_format を参照してください。
@param args フォーマットされるオブジェクトを指定し......。
require 'zlib'
filename='hoge1.gz'
fw = File.open(filename, "w")
Zlib::GzipWriter.wrap(fw, Zlib::BEST_COMPRESSION){|gz|
gz.printf("\n%9s", "bar")
}
fr = File.open(filename)
Zlib::GzipReader.wrap(fr){|gz|
puts gz.read
}
#=> bar
@see IO#printf, Kernel.#printf... -
NEWS for Ruby 3
. 0 . 0 (1704.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...照してください。
== 言語仕様の変更
* Keyword arguments are now separated from positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords......//}
* Binding
* Binding#eval when called with one argument will use `"(eval)"` for `__FILE__` and `1` for `__LINE__` in the evaluated code. 4352 17419
* ConditionVariable
* ConditionVariable#wait may now invoke the `block`/`unblock` scheduler hooks in a non-blocking context. 16786
* D......a.join`.
* Set#<=> is added.
* Socket
* Add :connect_timeout to TCPSocket.new 17187
* Net::HTTP
* Net::HTTP#verify_hostname= and Net::HTTP#verify_hostname have been added to skip hostname verification. 16555
* Net::HTTP.get, Net::HTTP.get_response, and Net::HTTP.get_print can ta... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (1062.0) -
1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))
...の変更点(まとめ)
* ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>))
* ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>))
* ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>))
* ((<1.6.8から1.8.0......り、(({$?})) の値も整数からこのクラ
スのインスタンスになりました。
=== クラス階層
: ((<File::Constants>))
File::Constants は、File クラスでなく IO クラスが include するように
なりました。((<ruby-dev:20964>))
: ((<UnboundMethod>)) [com......。
((<ruby-dev:14172>))
== 拡張されたクラス/メソッド(互換性のある変更)
=== 組み込み関数
: ((<組み込み関数/sprintf>)) [new]
"%p" が追加されました。inspect の結果が利用されます。((<RCR#69>))
: ((<組み込み関数/trap>)) [compat]
あ... -
クラス/メソッドの定義 (558.0)
-
クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined
...ソッドの定義
* クラス/メソッドの定義:
* class
* singleton_class
* module
* method
* operator
* nest_method
* eval_method
* singleton_method
* class_method
* limit
* 定義に関する操作:
* alias
* undef
* defined
===[a:c...... File::Constants を include することで、
# File::RDONLY などと書かずに直接 RDONLY と書くことができる。
class File
module Constants
RDONLY = 0
WRONLY = 1
end
include Constants
end
File.open("foo", File::RDONLY)
# あるいは
include File::Constants
File.ope......foo(3) { print "Ruby! " } #=> Ruby! Ruby! Ruby!
//}
メソッド定義において、仮引数はその種類毎に以下の順序でしか指定すること
はできません。いずれも省略することは可能です。
* デフォルト式のない引数(複数指定可)
* デフ... -
制御構造 (360.0)
-
制御構造 条件分岐: * if * unless * case 繰り返し: * while * until * for * break * next * redo * retry 例外処理: * raise * begin その他: * return * BEGIN * END
...制御構造
条件分岐:
* if
* unless
* case
繰り返し:
* while
* until
* for
* break
* next
* redo
* retry
例外処理:
* raise
* begin
その他:
* return
* BEGIN
* END
Rubyでは(Cなどとは異なり)制御構造は式であ......クラス設計者が定義する事が出来るものです.
=== 条件分岐
====[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]......ure 節を定義でき、これにより例外を処理することが
できます。
==== rescue修飾子
//emlist[例][ruby]{
open("nonexistent file") rescue STDERR.puts "Warning: #$!"
//}
文法:
式1 rescue 式2
式1で例外が発生したとき、式2を評価します。
以... -
rss (342.0)
-
RSS を扱うためのライブラリです。
...RSS を扱うためのライブラリです。
=== 参考
* RSS 0.91 http://backend.userland.com/rss091
* RSS 1.0 http://purl.org/rss/1.0/spec
* RSS 2.0 http://www.rssboard.org/rss-specification
* Atom 1.0 https://www.ietf.org/rfc/rfc4287.txt
=== 注意
RSS ParserはRSS 0.9x/1.0/2.0, A......す(使用するXMLパー
サによっては File や IO オブジェクトなどでもパース可能です)。
* RSS 1.0をパースした場合は RSS::RDF オブジェクト
* RSS 0.9x/2.0をパースした場合は RSS::Rss オブジェクト
* Atom をパースした場合は RSS::Atom::Fee......begin
feed = RSS::Parser.parse(File.read(fname), false)
rescue RSS::Error
end
if feed.nil?
puts "#{fname}はRSS 0.9x/1.0/2.0, Atom 1.0のいずれでもありません。"
else
print_items(feed)
end
end
あとはprint_itemsというメソッドを定義す... -
CSV
. open(filename , mode = "rb" , options = Hash . new) -> CSV (340.0) -
このメソッドは IO オブジェクトをオープンして CSV でラップします。 これは CSV ファイルを書くための主要なインターフェイスとして使うことを意図しています。
... File に委譲します。
* IO#binmode
* IO#binmode?
* IO#close
* IO#close_read
* IO#close_write
* IO#closed?
* IO#eof
* IO#eof?
* IO#external_encoding
* IO#fcntl
* IO#fileno
* File#flock
* IO#flush
* IO#fsync
* IO#internal_encoding
* IO#ioctl
* IO#isatty
* Fil......e#path
* IO#pid
* IO#pos
* IO#pos=
* IO#reopen
* IO#seek
* IO#stat
* StringIO#string
* IO#sync
* IO#sync=
* IO#tell
* IO#to_i
* IO#to_io
* File#truncate
* IO#tty?
@param filename ファイル名を指定します。
@param mode IO.open に指定できるものと同じ......1", "taro", "tanaka", "20"]
csv << ["2", "jiro", "suzuki", "18"]
csv << ["3", "ami", "sato", "19"]
csv << ["4", "yumi", "adachi", "21"]
end
print File.read("test.csv")
# => id,first name,last name,age
# 1,taro,tanaka,20
# 2,jiro,suzuki,18
# 3,ami,sato,19
# 4,yumi,adachi,21
//}
@s... -
CSV
. open(filename , mode = "rb" , options = Hash . new) {|csv| . . . } -> nil (340.0) -
このメソッドは IO オブジェクトをオープンして CSV でラップします。 これは CSV ファイルを書くための主要なインターフェイスとして使うことを意図しています。
... File に委譲します。
* IO#binmode
* IO#binmode?
* IO#close
* IO#close_read
* IO#close_write
* IO#closed?
* IO#eof
* IO#eof?
* IO#external_encoding
* IO#fcntl
* IO#fileno
* File#flock
* IO#flush
* IO#fsync
* IO#internal_encoding
* IO#ioctl
* IO#isatty
* Fil......e#path
* IO#pid
* IO#pos
* IO#pos=
* IO#reopen
* IO#seek
* IO#stat
* StringIO#string
* IO#sync
* IO#sync=
* IO#tell
* IO#to_i
* IO#to_io
* File#truncate
* IO#tty?
@param filename ファイル名を指定します。
@param mode IO.open に指定できるものと同じ......1", "taro", "tanaka", "20"]
csv << ["2", "jiro", "suzuki", "18"]
csv << ["3", "ami", "sato", "19"]
csv << ["4", "yumi", "adachi", "21"]
end
print File.read("test.csv")
# => id,first name,last name,age
# 1,taro,tanaka,20
# 2,jiro,suzuki,18
# 3,ami,sato,19
# 4,yumi,adachi,21
//}
@s... -
CSV
. open(filename , options = Hash . new) -> CSV (340.0) -
このメソッドは IO オブジェクトをオープンして CSV でラップします。 これは CSV ファイルを書くための主要なインターフェイスとして使うことを意図しています。
... File に委譲します。
* IO#binmode
* IO#binmode?
* IO#close
* IO#close_read
* IO#close_write
* IO#closed?
* IO#eof
* IO#eof?
* IO#external_encoding
* IO#fcntl
* IO#fileno
* File#flock
* IO#flush
* IO#fsync
* IO#internal_encoding
* IO#ioctl
* IO#isatty
* Fil......e#path
* IO#pid
* IO#pos
* IO#pos=
* IO#reopen
* IO#seek
* IO#stat
* StringIO#string
* IO#sync
* IO#sync=
* IO#tell
* IO#to_i
* IO#to_io
* File#truncate
* IO#tty?
@param filename ファイル名を指定します。
@param mode IO.open に指定できるものと同じ......1", "taro", "tanaka", "20"]
csv << ["2", "jiro", "suzuki", "18"]
csv << ["3", "ami", "sato", "19"]
csv << ["4", "yumi", "adachi", "21"]
end
print File.read("test.csv")
# => id,first name,last name,age
# 1,taro,tanaka,20
# 2,jiro,suzuki,18
# 3,ami,sato,19
# 4,yumi,adachi,21
//}
@s...