133件ヒット
[1-100件を表示]
(0.035秒)
別のキーワード
種類
- インスタンスメソッド (67)
- ライブラリ (33)
- 文書 (22)
- クラス (11)
ライブラリ
- ビルトイン (67)
-
irb
/ cmd / help (11)
クラス
-
IRB
:: ExtendCommand :: Help (11) - Method (6)
- Proc (6)
-
RubyVM
:: InstructionSequence (44)
キーワード
- Numeric (11)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
-
absolute
_ path (11) -
base
_ label (11) - execute (11)
- irb (11)
- label (11)
- path (11)
-
rexml
/ parsers / sax2parser (11) -
rexml
/ parsers / streamparser (11) -
ruby 1
. 6 feature (11)
検索結果
先頭5件
-
Method
# >>(callable) -> Proc (39154.0) -
self と引数を合成した Proc を返します。
...ます。
Method#<< とは呼び出しの順序が逆になります。
@param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。
//emlist[例][ruby]{
def f(x)
x * x
end
def g(x)
x + x
end
# (3 * 3) + (3 * 3)
p (method(:f) >> method(:g)).call(3......uby]{
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') # => ["Hello", "World", "Hello", "Ruby"]
//}
@see Proc#<<, Proc#>>... -
Proc
# >>(callable) -> Proc (18142.0) -
self と引数を合成した Proc を返します。
...しの順序が逆になります。
@param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。
//emlist[例][ruby]{
f = proc { |x| x * x }
g = proc { |x| x + x }
# (3 * 3) + (3 * 3)
p (f >> g).call(3) # => 18
//}
//emlist[call を定義したオブ......anner
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') # => ["Hello", "World", "Hello", "Ruby"]
//}
@see Method#<<, Method#>>... -
rexml
/ parsers / sax2parser (378.0) -
SAX2 と同等の API を持つストリーム式の XML パーサ。
...ner
def method_missing(name, *args)
p [name, *args]
end
def respond_to_missing?(name, include_private)
name != :call
end
end
parser = REXML::Parsers::SAX2Parser.new(xml)
parser.listen(Listener.new)
parser.parse
# >> [:start_document]
# >> [:xmldecl, "1.0", "UTF-8", nil]
# >> [:progr......ess, 39]
# >> [:characters, "\n"]
# >> [:progress, 91]
# >> [:processing_instruction, "xml-stylesheet", " type=\"text/css\" href=\"style.css\""]
# >> [:progress, 91]
# >> [:characters, "\n"]
# >> [:progress, 144]
# >> [:doctype, "root", "SYSTEM", "foo", nil]
# >> [:progress, 144]
# >> [:elementdecl,......a+)"]
# >> [:progress, 144]
# >> [:elementdecl, "<!ELEMENT a"]
# >> [:progress, 159]
# >> [:entitydecl, "bar", "barbarbarbar"]
# >> [:progress, 190]
# >> [:attlistdecl, "a", {"att"=>nil, "xyz"=>"foobar"}, " \n <!ATTLIST a att CDATA #REQUIRED xyz CDATA \"foobar\">"]
# >> [:progress, 245]
# >> [:nota... -
rexml
/ parsers / streamparser (144.0) -
ストリーム式の XML パーサ。
...oot>
EOS
class Listener
def method_missing(name, *args)
p [name, *args]
end
def respond_to_missing?(sym, include_private)
true
end
end
REXML::Parsers::StreamParser.new(xml, Listener.new).parse
# >> [:xmldecl, "1.0", "UTF-8", nil]
# >> [:text, "\n"]
# >> [:instruction, "xml-styleshe......et", " type=\"text/css\" href=\"style.css\""]
# >> [:text, "\n"]
# >> [:doctype, "root", "SYSTEM", "foo", nil]
# >> [:elementdecl, "<!ELEMENT root (a+)"]
# >> [:elementdecl, "<!ELEMENT a"]
# >> [:entitydecl, ["bar", "barbarbarbar"]]
# >> [:attlistdecl, "a", {"att"=>nil, "xyz"=>"foobar"}, " \n <!ATT......EQUIRED xyz CDATA \"foobar\">"]
# >> [:notationdecl, ["foobar", "SYSTEM", nil, "http://example.org/foobar.dtd"]]
# >> [:entitydecl, ["HTMLsymbol", "PUBLIC", "-//W3C//ENTITIES Symbols for XHTML//EN", "xhtml-symbol.ent", "%"]]
# >> [:doctype_end]
# >> [:text, "\n"]
# >> [:tag_start, "root", {"xmlns:fo... -
ruby 1
. 6 feature (96.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...Fixnum#>>, <<
負の数に対して右シフトすると 0 になることがありました。
((<ruby-bugs-ja:PR#247>))
負の数を引数にした左シフト(つまり右シフト)も同様におかしな挙動をして
いました。((<ruby-bugs-ja:PR#248>))
p(-1 >> 31)......roc#yield を呼んでいました。
((<ruby-dev:16178>))
Marshal.load(Marshal.dump('foo'), proc {|o| p o})
=> -:1:in `load': undefined method `yield' for #<Proc:0x401b1b30> (NameError)
from -:1
ruby 1.6.7 (2002-03-01) [i586-linux]
=> ruby 1.6.6 (2001-12-26) [i586......"+\000"
"*+\000"
: method_missing
以下が Segmentation Fault していました。((<ruby-dev:14942>))
Module.constants.each {|c|
c = eval c
if c.instance_of?(Class)
p c
c.instance_methods.each {|m|
c.module_e... -
RubyVM
:: InstructionSequence # base _ label -> String (30.0) -
self が表す命令シーケンスの基本ラベルを返します。
...quence:<compiled>@<compiled>>
iseq.base_label
# => "<compiled>"
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.base_label #......=> "<main>"
例3:
# /tmp/method2.rb
def hello
puts "hello, world"
end
RubyVM::InstructionSequence.of(method(:hello)).base_label
# => "hello"
@see RubyVM::InstructionSequence#label... -
RubyVM
:: InstructionSequence # label -> String (30.0) -
self が表す命令シーケンスのラベルを返します。通常、メソッド名、クラス名、 モジュール名などで構成されます。
...d>>
iseq.label
# => "<compiled>"
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.label # => "<main>"
例3:
# /tmp/method......2.rb
def hello
puts "hello, world"
end
RubyVM::InstructionSequence.of(method(:hello)).label
# => "hello"
@see RubyVM::InstructionSequence#base_label... -
RubyVM
:: InstructionSequence # absolute _ path -> String | nil (24.0) -
self が表す命令シーケンスの絶対パスを返します。
...ompiled>>
iseq.absolute_path
# => nil
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.absolute_path # => "/tmp/method.rb"
@... -
RubyVM
:: InstructionSequence # path -> String (24.0) -
self が表す命令シーケンスの相対パスを返します。
...mpiled>@<compiled>>
iseq.path
# => "<compiled>"
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end
# irb
> iseq = RubyVM::InstructionSequence.compile_file('method.rb')
> iseq.path # => "method.rb"
@see RubyV... -
irb (24.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...b(main):006:0> irb # サブ irb を起動
irb#1(main):001:0> x # x を表示
NameError: undefined local variable or method `x' for main:Object
from (irb#1):1:in `Kernel#binding'
起動時のインタプリタでローカル変数 x を定義しましたが、
「i......running)
#1->irb#1 on main (#<Thread:0x40125d64> : stop)
#2->irb#2 on Foo (#<Thread:0x4011d54c> : stop)
nil
irb(main):005:0> Foo.instance_methods # Foo#fooがちゃんと定義さ
# れている
["foo"]
irb(main):006:0> fg 2......プロンプトに戻る事が
できます。
//emlist{
irb(main):001:0> help
Enter the method name you want to look up.
You can use tab to autocomplete.
Enter a blank line to exit.
>> String#match
String#match
(from ruby core)
-----------------------------------------------...