144件ヒット
[1-100件を表示]
(0.036秒)
別のキーワード
ライブラリ
- ビルトイン (24)
- erb (24)
- forwardable (24)
- json (60)
- win32ole (12)
クラス
- ERB (24)
- Method (12)
-
RubyVM
:: InstructionSequence (12) -
WIN32OLE
_ TYPE (12)
モジュール
キーワード
-
def
_ class (12) -
def
_ delegator (12) -
def
_ instance _ delegator (12) -
def
_ module (12) -
default
_ event _ sources (12) -
source
_ location (12) -
to
_ a (12) -
to
_ json (48) -
to
_ json _ raw _ object (12)
検索結果
先頭5件
- Method
# source _ location -> [String , Integer] | nil - ERB
# def _ class(superklass=Object , methodname=& # 39;erb& # 39;) -> Class - JSON
:: Generator :: GeneratorMethods :: FalseClass # to _ json(state _ or _ hash = nil) -> String - JSON
:: Generator :: GeneratorMethods :: NilClass # to _ json(state _ or _ hash = nil) -> String - JSON
:: Generator :: GeneratorMethods :: TrueClass # to _ json(state _ or _ hash = nil) -> String
-
Method
# source _ location -> [String , Integer] | nil (9031.0) -
ソースコードのファイル名と行番号を配列で返します。
...@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
//}... -
ERB
# def _ class(superklass=Object , methodname=& # 39;erb& # 39;) -> Class (6321.0) -
変換した Ruby スクリプトをメソッドとして定義した無名のクラスを返します。
... methodname メソッド名
//emlist[例][ruby]{
require 'erb'
class MyClass_
def initialize(arg1, arg2)
@arg1 = arg1; @arg2 = arg2
end
end
filename = 'example.rhtml' # @arg1 と @arg2 が使われている example.rhtml
erb = ERB.new(File.read(filename))
erb.filename = filename
MyClass......= erb.def_class(MyClass_, 'render()')
print MyClass.new('foo', 123).render()
# => test1foo
# test2123
//}... -
JSON
:: Generator :: GeneratorMethods :: FalseClass # to _ json(state _ or _ hash = nil) -> String (6007.0) -
自身から生成した JSON 形式の文字列を返します。
...JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
false.to_json # => "false"
//}... -
JSON
:: Generator :: GeneratorMethods :: NilClass # to _ json(state _ or _ hash = nil) -> String (6007.0) -
自身から生成した JSON 形式の文字列を返します。
...る JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
nil.to_json # => "null"
//}... -
JSON
:: Generator :: GeneratorMethods :: TrueClass # to _ json(state _ or _ hash = nil) -> String (6007.0) -
自身から生成した JSON 形式の文字列を返します。
...る JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby]{
require "json"
true.to_json # => "true"
//}... -
JSON
:: Generator :: GeneratorMethods :: Object # to _ json(state _ or _ hash = nil) -> String (3019.0) -
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
...例][ruby]{
require "json"
class Person
attr :name, :age
def initialize(name, age)
@name, @age = name, age
end
end
tanaka = Person.new("tanaka", 29)
tanaka.to_json # => "\"#<Person:0x00007ffdec0167c8>\""
tanaka.method(:to_json).owner # => JSON::Ext::Generator::GeneratorMethods::Object... -
JSON
:: Generator :: GeneratorMethods :: String # to _ json _ raw _ object -> Hash (3013.0) -
生の文字列を格納したハッシュを生成します。
...UTF-8 の文字列ではなく生の文字列を JSON に変換する場合に使用してください。
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... -
Forwardable
# def _ delegator(accessor , method , ali = method) -> () (229.0) -
メソッドの委譲先を設定します。
...。
@param accessor 委譲先のオブジェクト
@param method 委譲先のメソッド
@param ali 委譲元のメソッド
委譲元のオブジェクトで ali が呼び出された場合に、
委譲先のオブジェクトの method へ処理が委譲されるようになります。
委......ます。
//emlist[例][ruby]{
require 'forwardable'
class MyQueue
extend Forwardable
attr_reader :queue
def initialize
@queue = []
end
def_delegator :@queue, :push, :mypush
end
q = MyQueue.new
q.mypush 42
q.queue # => [42]
q.push 23 # => NoMethodError
//}
@see Forwardable#def... -
Forwardable
# def _ instance _ delegator(accessor , method , ali = method) -> () (229.0) -
メソッドの委譲先を設定します。
...。
@param accessor 委譲先のオブジェクト
@param method 委譲先のメソッド
@param ali 委譲元のメソッド
委譲元のオブジェクトで ali が呼び出された場合に、
委譲先のオブジェクトの method へ処理が委譲されるようになります。
委......ます。
//emlist[例][ruby]{
require 'forwardable'
class MyQueue
extend Forwardable
attr_reader :queue
def initialize
@queue = []
end
def_delegator :@queue, :push, :mypush
end
q = MyQueue.new
q.mypush 42
q.queue # => [42]
q.push 23 # => NoMethodError
//}
@see Forwardable#def...