るりまサーチ

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

別のキーワード

  1. tsort each_strongly_connected_component_from
  2. prime int_from_prime_division
  3. _builtin from_name
  4. socket connect_from
  5. addrinfo connect_from

ライブラリ

キーワード

検索結果

Object::DATA -> File (19.0)

スクリプトの __END__ プログラムの終り以降をアクセスする File オブジェクト。

...あったとします。

library.rb:
print DATA.gets

__END__
data from library

app.rb:
require 'library.rb'

__END__
data from app

このときシェルから次を実行すると
$ ruby app.rb
結果は以下のように出力されます。
data from app...

Object#enum_for(method = :each, *args) -> Enumerator (7.0)

Enumerator.new(self, method, *args) を返します。

...す。

//emlist[][ruby]{
str = "xyz"

enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]

# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[例(ブロックを指定する場合)][ruby]{
module Enu...

Object#enum_for(method = :each, *args) {|*args| ... } -> Enumerator (7.0)

Enumerator.new(self, method, *args) を返します。

...す。

//emlist[][ruby]{
str = "xyz"

enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]

# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[例(ブロックを指定する場合)][ruby]{
module Enu...

Object#to_enum(method = :each, *args) -> Enumerator (7.0)

Enumerator.new(self, method, *args) を返します。

...す。

//emlist[][ruby]{
str = "xyz"

enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]

# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[例(ブロックを指定する場合)][ruby]{
module Enu...

Object#to_enum(method = :each, *args) {|*args| ... } -> Enumerator (7.0)

Enumerator.new(self, method, *args) を返します。

...す。

//emlist[][ruby]{
str = "xyz"

enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]

# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}

//emlist[例(ブロックを指定する場合)][ruby]{
module Enu...

絞り込み条件を変える

Object.yaml_tag(tag) -> () (7.0)

クラスと tag の間を関連付けます。

...end

attr_reader :x
end

# Dumps Ruby object normally
p Psych.dump(Foo.new(3))
# =>
# --- !ruby/object:Foo
# x: 3

# Registers tag with class Foo
Foo.yaml_as("tag:example.com,2013:foo")
# ... and dumps the object of Foo class
Psych.dump(Foo.new(3), STDOUT)
# =>...
...# --- !<tag:example.com,2013:foo>
# x: 3

# Loads the object from the tagged YAML node
p Psych.load(<<EOS)
--- !<tag:example.com,2012:foo>
x: 8
EOS
# => #<Foo:0x0000000130f48 @x=8>...