368件ヒット
[301-368件を表示]
(0.077秒)
クラス
-
ARGF
. class (216) - ERB (12)
- IO (12)
-
JSON
:: Parser (12) - Method (14)
- Module (4)
- Proc (14)
- Thread (36)
-
Thread
:: Backtrace :: Location (48)
キーワード
- << (14)
- >> (14)
-
absolute
_ path (12) -
add
_ trace _ func (12) -
attr
_ reader (4) - backtrace (12)
-
base
_ label (12) - binmode (12)
-
def
_ class (12) - file (12)
- filename (12)
- inspect (12)
- parse (12)
- path (12)
-
read
_ nonblock (12) - readbyte (24)
- readchar (12)
- readline (36)
- readlines (36)
- readpartial (12)
-
set
_ trace _ func (12) -
to
_ a (36) -
to
_ s (12)
検索結果
先頭5件
-
Thread
:: Backtrace :: Location # base _ label -> String (3007.0) -
self が表すフレームの基本ラベルを返します。通常、 Thread::Backtrace::Location#label から修飾を取り除いたもので構成 されます。
...self が表すフレームの基本ラベルを返します。通常、
Thread::Backtrace::Location#label から修飾を取り除いたもので構成
されます。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)......end
end
Foo.new(0..2).locations.map do |call|
puts call.base_label
end
# => initialize
# new
# <main>
//}
@see Thread::Backtrace::Location#label... -
Thread
:: Backtrace :: Location # inspect -> String (3007.0) -
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。
...Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文
字列に変換したオブジェクトを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).loc... -
Thread
:: Backtrace :: Location # to _ s -> String (3007.0) -
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。
...self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し
ます。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.to_s
end... -
JSON
:: Parser # parse -> object (25.0) -
現在のソースをパースして結果を Ruby のオブジェクトとして返します。
...す。
//emlist[例][ruby]{
require 'json'
class Person
attr_accessor :name, :age
def []=(key, value)
instance_variable_set("@#{key}", value)
end
end
parser = JSON::Parser.new(DATA.read, object_class: Person)
person = parser.parse
person.class # => Person
person.name # => "tanaka"
per... -
Method
# <<(callable) -> Proc (13.0) -
self と引数を合成した Proc を返します。
...定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT
pipeline = method(:pp) << WordScanner << File.method(:read)
pipeline.call('testfile') # => ["Hello", "World",... -
Method
# >>(callable) -> Proc (13.0) -
self と引数を合成した Proc を返します。
.../emlist[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT
pipeline = File.method(:read) >> WordScanner >> method(:pp)
pipeline.call('testfile') # => ["H... -
Proc
# <<(callable) -> Proc (13.0) -
self と引数を合成した Proc を返します。
...ジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT
pipeline = proc { |data| puts "word count: #{data.size}" } << WordScanner << File.method(:read)
pipeline.call('testfile') # => w... -
Proc
# >>(callable) -> Proc (13.0) -
self と引数を合成した Proc を返します。
...list[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end
File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT
pipeline = proc { |fname| File.read(fname) } >> WordScanner >> method(:p)
pipeline.call('testfile...