るりまサーチ

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

別のキーワード

  1. _builtin to_r
  2. open3 pipeline_r
  3. matrix elements_to_r
  4. fileutils cp_r
  5. fileutils rm_r

ライブラリ

クラス

キーワード

検索結果

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

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

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

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

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

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

JSON::Generator::GeneratorMethods::String#to_json_raw_object -> Hash (15119.0)

生の文字列を格納したハッシュを生成します。

...する場合に使用してください。

require
'json'
"にほんご".encode("euc-jp").to_json_raw_object
# => {"json_class"=>"String", "raw"=>[164, 203, 164, 219, 164, 243, 164, 180]}
"にほんご".encode("euc-jp").to_json # source sequence is illegal/malformed (JSON::GeneratorError)...

UnboundMethod#source_location -> [String, Integer] | nil (12333.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/rub...
...y/2.4.0/time.rb", 654]
//}

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

Method#source_location -> [String, Integer] | nil (12327.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
//}...