22件ヒット
[1-22件を表示]
(0.570秒)
検索結果
-
Method (77.0)
-
Object#method によりオブジェクト化され たメソッドオブジェクトのクラスです。
...Object#method によりオブジェクト化され
たメソッドオブジェクトのクラスです。
メソッドの実体(名前でなく)とレシーバの組を封入します。
Proc オブジェクトと違ってコンテキストを保持しません。
=== Proc との差
Method......、Method は大規模コードに向くと言えます。
既存のメソッドを Method オブジェクト化する。
//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end
m = Foo.new.method(:foo)
p m # => #<Method: Foo#foo>
p m.call(1) # =......なのは以下のような場合。
//emlist[例][ruby]{
class Foo
def foo() "foo" end
def bar() "bar" end
def baz() "baz" end
end
obj = Foo.new
# 任意のキーとメソッドの関係をハッシュに保持しておく
methods = {1 => obj.method(:foo),
2 => obj.method(:bar),... -
CSV (13.0)
-
このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。
...字エンコーディング (M17n or Multilingualization)
This new CSV parser is m17n savvy. The parser works in the Encoding of the IO
or String object being read from or written to. Your data is never transcoded
(unless you ask Ruby to transcode it for you) and will literally be parsed in
the E......'s Encodings.
Anyway, the practical side of this is simple: make sure IO and String objects
passed into CSV have the proper Encoding set and everything should just work.
CSV methods that allow you to open IO objects (CSV::foreach(), CSV::open(),
CSV::read(), and CSV::readlines()) do allow you to s...