427件ヒット
[1-100件を表示]
(0.063秒)
別のキーワード
種類
- インスタンスメソッド (300)
- ライブラリ (61)
- 文書 (33)
- 特異メソッド (22)
- クラス (11)
ライブラリ
- ビルトイン (228)
-
rexml
/ document (33) - shell (24)
-
shell
/ command-processor (24) -
shell
/ filter (24)
クラス
- Bignum (3)
-
Enumerator
:: Lazy (85) - Fixnum (3)
- Integer (21)
- Proc (6)
-
REXML
:: Element (22) -
REXML
:: XPath (11) - Range (11)
-
RubyVM
:: InstructionSequence (11) - Shell (24)
-
Shell
:: CommandProcessor (24) -
Shell
:: Filter (24) - String (77)
キーワード
- Numeric (11)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- [] (21)
-
absolute
_ path (11) - cat (18)
- chunk (22)
- each (11)
-
each
_ element _ with _ attribute (11) -
each
_ element _ with _ text (11) - echo (18)
- glob (18)
- gsub (44)
- irb (11)
- new (11)
-
rexml
/ document (11) -
rexml
/ parsers / pullparser (11) -
rexml
/ parsers / sax2parser (11) -
rexml
/ parsers / ultralightparser (11) -
ruby 1
. 6 feature (11) - shell (6)
-
slice
_ after (20) -
slice
_ before (33) -
slice
_ when (10) - sub (33)
- tee (18)
- 演算子式 (11)
検索結果
先頭5件
-
Bignum
# >>(bits) -> Fixnum | Bignum (18325.0) -
シフト演算子。bits だけビットを右にシフトします。
...フトします。
右シフトは、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。
@param bits シフトさせるビット数
printf("%#b\n", 0b0101 >> 1) #=> 0b10
p -1 >> 1 #=> -1... -
Fixnum
# >>(bits) -> Fixnum | Bignum (18325.0) -
シフト演算子。bits だけビットを右にシフトします。
...フトします。
右シフトは、符号ビット(最上位ビット(MSB))が保持されます。
bitsが実数の場合、小数点以下を切り捨てた値でシフトします。
@param bits シフトさせるビット数
printf("%#b\n", 0b0101 >> 1) #=> 0b10
p -1 >> 1 #=> -1... -
Proc
# >>(callable) -> Proc (18254.0) -
self と引数を合成した Proc を返します。
...c、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 を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def s......elf.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#>>... -
ruby 1
. 6 feature (5370.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...グ修正がメイン
になります。
((<stable-snapshot|URL:ftp://ftp.netlab.co.jp/pub/lang/ruby/stable-snapshot.tar.gz>)) は、日々更新される安定版の最新ソースです。
== 1.6.8 (2002-12-24) -> stable-snapshot
: 2003-01-22: errno
EAGAIN と EWOULDBLOCK が同じ値の......> ruby 1.6.7 (2002-03-01) [i586-linux]
Errno::EAGAIN
Errno::EWOULDBLOCK
=> ruby 1.6.8 (2002-12-24) [i586-linux]
Errno::EAGAIN
-:2: uninitialized constant EWOULDBLOCK at Errno (NameError)
=> ruby 1.6.8 (2003-02-13) [i586-linux]......].upcase!
p a
=> ruby 1.6.7 (2002-03-01) [i586-linux]
"KEY"
=> -:3:in `upcase!': can't modify frozen string (TypeError)
from -:3
ruby 1.6.7 (2002-08-01) [i586-linux]
: 2002-06-10 Fixnum#>>, <<
負の数に対して右シフトする... -
Numeric (2724.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
...されています。
演算や比較を行うメソッド(+, -, *, /, <=>)は Numeric のサブクラスで定義されま
す。Numeric で定義されているメソッドは、サブクラスで提供されているメソッド
(+, -, *, /, %) を利用して定義されるものがほとんど......95 (2014-05-08 revision 45877) [x86_64-linux]
Numeric Integer Fixnum Bignum Float Rational Complex
-------------------------------------------------------------------------------------------
% | o -......== | - - o o o - -
> | - - o o o - -
>= | - - o o o - -
>> |......198 (2017-09-14 revision 59899) [x86_64-darwin15]
Numeric Integer Float Rational Complex
--------------------------------------------------------------------------------
% | o o o - -......=== | - o o - -
> | - o o - -
>= | - o o - -
>> | - o - - -... -
rexml
/ parsers / sax2parser (426.0) -
SAX2 と同等の API を持つストリーム式の XML パーサ。
...elements = []
parser.listen(:start_element){|uri, localname, qname, attrs|
elements << [qname, attrs]
}
as = []
parser.listen(:start_element, ["a"]){|uri, localname, qname, attrs|
as << [qname, attrs]
}
texts = []
parser.listen(:characters, ["a"]){|c| texts << c }
parser.parse
elements # => [["......[仕様確認サンプル][ruby]{
require 'rexml/parsers/sax2parser'
require 'rexml/sax2listener'
xml = <<EOS
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/css" href="style.css"?>
<!DOCTYPE root SYSTEM "foo" [
<!ELEMENT root (a+)>
<!ELEMENT a>
<!ENTITY bar "barbarbarbar"......re--> &bar;
</root>
EOS
class Listener
#include REXML::SAX2Listener
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
# >>... -
REXML
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (267.0) -
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
...id'){|e| p e }
# >> <b id='1'/>
# >> <c id='2'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1'){|e| p e }
# >> <b id='1'/>
# >> <d id='1'/>
doc.root.each_element_with_attribute('id', '1', 1){|e| p e }
# >> <b id='1'/>
doc.root.each_element_with_attribute('id', '1', 0, 'd'){|e| p e... -
REXML
:: Element # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () (267.0) -
テキストを子ノードとして 持つすべての子要素を引数としてブロックを呼び出します。
...h_element_with_text {|e|p e}
# >> <b> ... </>
# >> <c> ... </>
# >> <d> ... </>
doc.root.each_element_with_text('b'){|e|p e}
# >> <b> ... </>
# >> <c> ... </>
doc.root.each_element_with_text('b', 1){|e|p e}
# >> <b> ... </>
doc.root.each_element_with_text(nil, 0, 'd'){|e|p e}
# >> <d> ... </>
//}... -
irb (264.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...ons:
-f ~/.irbrc を読み込まない
-m bc モード (分数と行列の計算ができる)
-d $DEBUG を true にする (ruby -d と同じ)
-w ruby -w と同じ
-W[level=2] ruby -W と同じ
-r library ruby -r......設定をまとめて設定することができます。
以下に例を示します。
$ irb
irb(main):001:0> IRB.conf[:IRB_RC] = lambda {|conf| conf.prompt_i = "> " }
=> #<Proc:0x00002a95fa3fd8@(irb):2>
irb(main):002:0> irb
>
=== irb の使用例
irb のいろいろな使用例を......tocomplete.
Enter a blank line to exit.
>> String#match
String#match
(from ruby core)
------------------------------------------------------------------------------
str.match(pattern) -> matchdata or nil
str.match(pattern, pos) -> matchdata or nil
...
//}
=== シ......s:
-f ~/.irbrc を読み込まない
-d $DEBUG を true にする (ruby -d と同じ)
-w ruby -w と同じ
-W[level=2] ruby -W と同じ
-r library ruby -r と同じ
-I ruby -I と同じ
-U ruby -U... -
rexml
/ parsers / pullparser (252.0) -
プル方式の XML パーサ。
...n (ターゲット文字列, 内容文字列 | nil)
XML処理命令(Processing Instruction, PI)
: comment (コメント文字列)
コメント
: start_doctype (ルート要素名, "SYSTEM" | "PUBLIC" | nil, システム識別子 | nil, 公開識別子 | nil)
DTD 開始。判定は REXML::Parse......ディング文字列 | nil, standalone ("yes" | "no" | nil))
XML宣言
: externalentity (エンティティ文字列)
doctype内のパラメータ実体参照。
//emlist[][ruby]{
require 'rexml/parsers/pullparser'
xml = <<EOS
<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text......mp;& <!-- comment here--> &bar;
</root>
EOS
parser = REXML::Parsers::PullParser.new(xml)
while parser.has_next?
p parser.pull
end
# >> xmldecl: ["1.0", "UTF-8", nil]
# >> text: ["\n", "\n"]
# >> processing_instruction: ["xml-stylesheet", " type=\"text/css\" href=\"style.css\""]
# >> text: ["\... -
Enumerator
:: Lazy # chunk {|elt| . . . } -> Enumerator :: Lazy (232.0) -
Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。
...はなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>
1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[false, [1, 2]], [true, [3]], [false, [4, 5]], [tru...