るりまサーチ

最速Rubyリファレンスマニュアル検索!
247件ヒット [1-100件を表示] (0.129秒)

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 > >>

JSON::Parser#source -> String (18114.0)

現在のソースのコピーを返します。

...現在のソースのコピーを返します。

//emlist[例][ruby]{
require 'json'

parser = JSON::Parser.new(DATA.read)
print parser.source

# => {
# => "Tanaka": {
# => "name":"tanaka",
# => "age":20
# => },
# => "Suzuki": {
# => "name":"suzuki",
# => "age":25
# => }
#...

Regexp#source -> String (18114.0)

その正規表現のもととなった文字列表現を生成して返します。

...その正規表現のもととなった文字列表現を生成して返します。

//emlist[例][ruby]{
re = /foo|bar|baz/i
p re.source # => "foo|bar|baz"
//}...

Module#const_source_location(name, inherited = true) -> [String, Integer] (6174.0)

name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。

...す。

//emlist[例][ruby]{
# test.rb:
class A # line 1
C1 = 1
C2 = 2
end

module M # line 6
C3 = 3
end

class B < A # line 10
include M
C4 = 4
end

class A # 継続して A を定義する
C2 = 8 # 定数を再定義する
end

p B.const_source_location('C4')...
...# => ["test.rb", 12]
p B.const_source_location('C3') # => ["test.rb", 7]
p B.const_source_location('C1') # => ["test.rb", 2]

p B.const_source_location('C3', false) # => nil -- include したモジュールは検索しない

p A.const_source_location('C2') # => [...
...

p Object.const_source_location('B') # => ["test.rb", 10] -- Object はトップレベルの定数を検索する
p Object.const_source_location('A') # => ["test.rb", 1] -- クラスが再定義された場合は最初の定義位置を返す

p B.const_source_location('A')...

WIN32OLE_TYPE#default_event_sources -> [WIN32OLE_TYPE] (6149.0)

型が持つソースインターフェイスを取得します。

...型が持つソースインターフェイスを取得します。

default_event_sourcesメソッドは、selfがCoClass(コンポーネントクラス)
の場合、そのクラスがサポートするデフォルトのソースインターフェイス(イ
ベントの通知元となるイン...
...ない場合は空配列を返します。

tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'Worksheet')
tobj.default_event_sources.map {|intf| intf.name} #=> ["DocEvents"]

WIN32OLE_EVENT.newでインターフェイス名を指定しない場合は、ここで
返されたイ...
...osoft Internet Controls', 'InternetExplorer')
ctl = WIN32OLE.new(type.progid)
source
= type.default_event_sources[0]
class WebEvent
def initialize
@completed = false
end
attr_reader :completed
end
source
.ole_methods.each do |m|
WebEvent.module_eval do
define_method("on#{m....

Proc#source_location -> [String, Integer] | nil (6144.0)

ソースコードのファイル名と行番号を配列で返します。

...の手続オブジェクトが ruby で定義されていない(つまりネイティブ
である)場合は nil を返します。


//emlist[例][ruby]{
# /path/to/target.rb を実行
proc {}.source_location # => ["/path/to/target.rb", 1]
proc {}.source_location # => ["/path/...
...to/target.rb", 2]
(eval "proc {}").source_location # => ["(eval)", 1]
method(:p).to_proc.source_location # => nil
//}

@see Method#source_location...

絞り込み条件を変える

UnboundMethod#source_location -> [String, Integer] | nil (6144.0)

ソースコードのファイル名と行番号を配列で返します。

... ruby で定義されていない(つまりネイティブ
である)場合は nil を返します。

//emlist[例][ruby]{
require 'time'

Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2...
....4.0/time.rb", 654]
//}

@see Proc#source_location, Method#source_location...

Method#source_location -> [String, Integer] | nil (6132.0)

ソースコードのファイル名と行番号を配列で返します。

...と行番号を配列で返します。

その手続オブジェクトが ruby で定義されていない(つまりネイティブ
である)場合は nil を返します。

@see Proc#source_location

//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
def foo; end
end
# ----- end of...
.../tmp/foo.rb ----

require '/tmp/foo'

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.source_location # => ["/tmp/foo.rb", 2]

method(:puts).source_location # => nil
//}...

Binding#source_location -> [String, Integer] (6130.0)

self の Ruby のソースファイル名と行番号を返します。

...self の Ruby のソースファイル名と行番号を返します。

d:spec/variables#pseudo の __FILE__ と __LINE__ も参照してください。

//emlist[例][ruby]{
p binding.source_location # => ["test.rb", 1]
//}...

Encoding::Converter#source_encoding -> Encoding (6114.0)

変換元のエンコーディングを返します。

...変換元のエンコーディングを返します。

@return 変換元のエンコーディング

//emlist[][ruby]{
ec = Encoding::Converter.new("utf-8", "euc-jp")
ec.source_encoding #=> #<Encoding:UTF-8>
//}...
<< 1 2 3 > >>