別のキーワード
ライブラリ
- ビルトイン (64)
- csv (366)
- forwardable (24)
- open3 (48)
- openssl (12)
- psych (8)
-
rexml
/ document (216) - socket (48)
- thread (2)
クラス
- CSV (312)
-
CSV
:: FieldInfo (24) -
CSV
:: Row (30) - Enumerator (6)
-
File
:: Stat (12) -
REXML
:: Attributes (144) -
REXML
:: Element (36) -
REXML
:: XPath (12) - Range (12)
-
RubyVM
:: InstructionSequence (24) - Socket (48)
モジュール
- Forwardable (24)
- Open3 (48)
- Psych (8)
キーワード
- << (12)
- <=> (12)
- Default (12)
- OCSP (12)
- Queue (12)
- Ruby用語集 (12)
- Transitive (12)
- [] (12)
- []= (12)
-
add
_ row (12) - attribute (12)
-
cgi
/ session (12) -
col
_ sep (12) - convert (36)
- deconstruct (3)
-
deconstruct
_ keys (3) - delegate (12)
- delete (12)
-
delete
_ all (12) - each (24)
-
each
_ attribute (12) -
fiddle
/ import (12) - fields (12)
- filter (36)
-
first
_ lineno (12) - generate (12)
-
get
_ attribute (12) -
get
_ attribute _ ns (12) - header (12)
-
header
_ convert (36) - index (12)
- instance (24)
-
instance
_ delegate (12) - length (12)
- namespaces (12)
- new (24)
- open (48)
- parse (24)
-
pipeline
_ rw (24) -
pipeline
_ w (24) - pp (4)
- prefixes (12)
- produce (6)
- puts (12)
- rdoc (12)
- read (12)
- readlines (12)
- root (12)
-
root
_ node (12) - rss (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 9 feature (12) -
safe
_ load (8) - size (12)
-
to
_ a (12) - tsort (12)
-
udp
_ server _ sockets (48) -
values
_ at (12) -
yaml
/ store (12)
検索結果
先頭5件
-
REXML
:: XPath . first(element , path = nil , namespaces = {} , variables = {}) -> Node | nil (18143.0) -
element の path で指定した XPath 文字列にマッチする最初のノードを 返します。
...st[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:x='1'>
<a>
<b>b1</b>
<x:c />
<b>b2</b>
<d />
</a>
<b> b3 </b>
</root>
EOS
a = doc.root.elements[1] # => <a> ... </>
b1 = REXML::XPath.first(a, "b")
b1.text # => "b1"
REXML::XPath.first(doc, "/ro......ot/a/x:c") # => <x:c/>
REXML::XPath.first(a, "x:c") # => <x:c/>
REXML::XPath.first(a, "y:c") # => nil
REXML::XPath.first(a, "y:c", {"y" => "1"}) # => <x:c/>
b2 = REXML::XPath.first(doc, "/root/a/b[text()=$v]", {}, {"v" => "b2"})
b2 # => <b> ... </>
b2.text # => "b2"
//}... -
RubyVM
:: InstructionSequence # first _ lineno -> Integer (6119.0) -
self が表す命令シーケンスの 1 行目の行番号を返します。
...の 1 行目の行番号を返します。
例1:irb で実行した場合
RubyVM::InstructionSequence.compile('num = 1 + 2').first_lineno
# => 1
例2:
# /tmp/method.rb
require "foo-library"
def foo
p :foo
end
RubyVM::InstructionSequence.of(method(:foo)).first_lineno
# => 2... -
rss (150.0)
-
RSS を扱うためのライブラリです。
...されているものとします。
require 'rss'
rss = RSS::Parser.parse(rss_source, true)
RSS::Parser.parse の第二引数は省略すると true が指定されたもの
とみなされるので、これは以下のようにも書けます。
require 'rss'
rss = RSS::Parser.parse(rss......パースして,valid ではない RSS だった
場合はバリデーション無しでパースするには以下のように書きます。
require 'rss'
rss = nil
begin
rss = RSS::Parser.parse(rss_source)
rescue RSS::InvalidRSSError
rss = RSS::Parser.parse(rss_source, false)......(["My site", ...]など)
rss.channel.dc_titles.first.value == rss.channel.dc_title
# => true
# 厳密にはこう
first_title = rss.channel.dc_titles.first
first_title = first_title.value if first_title
first_title == rss.channel.dc_title... -
Range
. new(first , last , exclude _ end = false) -> Range (141.0) -
first から last までの範囲オブジェクトを生成して返しま す。
...
first から last までの範囲オブジェクトを生成して返しま
す。
exclude_end が真ならば終端を含まない範囲オブジェクトを生
成します。exclude_end 省略時には終端を含みます。
@param first 最初のオブジェクト
@param last 最後のオブ......mentError first <=> last が nil の場合に発生します
//emlist[例: 整数の範囲オブジェクトの場合][ruby]{
Range.new(1, 10) # => 1..10
Range.new(1, 10, true) # => 1...10
//}
//emlist[例: 日付オブジェクトの範囲オブジェクトの場合][ruby]{
require 'date'
R......d| puts d }
# => 2017-09-16
# 2017-09-17
# ...
# 2017-10-16
//}
//emlist[例: IPアドレスの範囲オブジェクトの場合][ruby]{
require 'ipaddr'
Range.new(IPAddr.new("192.0.2.1"), IPAddr.new("192.0.2.3")).each {|ip| puts ip}
# => 192.0.2.1
# 192.0.2.2
# 192.0.2.3
//}
//emli... -
ruby 1
. 6 feature (132.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...p /a#{Regexp.quote("#")}b/x =~ "ab"
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-03-01) [i586-linux]
"#"
0
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-07-30) [i586-linux]......p /a#{Regexp.quote("\t")}b/x =~ "ab"
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-03-01) [i586-linux]
"\t"
0
=> -:3: warning: ambiguous first argument; make sure
ruby 1.6.7 (2002-05-04) [i586-linux]......張ライブラリに対して autoload が効いていませんでした。((<ruby-dev:16379>))
autoload :Fcntl, "fcntl"
require "fcntl"
=> -:2:in `require': uninitialized constant Fcntl (NameError)
from -:2
ruby 1.6.7 (2002-03-01) [i586-linux]
=> ruby 1.6.7 (2... -
Open3
. # pipeline _ rw(*cmds) {|first _ stdin , last _ stdout , wait _ thrs| . . . } -> () (107.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。最初の コマンドの標準入力に書き込む事も最後のコマンドの標準出力を受けとる事も できます。
...行するコマンドの標準出力、実行したプロセスを待つため
のスレッドの配列を配列で返します。
例:
require "open3"
Open3.pipeline_rw("sort", "cat -n") {|stdin, stdout, wait_thrs|
stdin.puts "foo"
stdin.puts "bar"
stdin.puts "baz"... -
Open3
. # pipeline _ w(*cmds) {|first _ stdin , wait _ thrs| . . . } -> () (107.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。最初の コマンドの標準入力に書き込む事ができます。
...た場合は最初に実行するコマンドの標準入力、
実行したプロセスを待つためのスレッドの配列を配列で返します。
例:
require "open3"
Open3.pipeline_w("bzip2 -c", :out=>"/tmp/hello.bz2") {|w, ts|
w.puts "hello"
}
@see Open3.#popen3... -
CSV
. open(filename , mode = "rb" , options = Hash . new) -> CSV (66.0) -
このメソッドは IO オブジェクトをオープンして CSV でラップします。 これは CSV ファイルを書くための主要なインターフェイスとして使うことを意図しています。
...ック指定なし][ruby]{
require "csv"
File.write("test.csv", <<CSV)
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
csv = CSV.open("test.csv", headers: true)
csv.class # => CSV
csv.first # => #<CSV::Row "id":"1" "first name":"taro" "last name":"ta......定あり][ruby]{
require "csv"
users =<<-EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS
File.write("test.csv", users)
CSV.open("test.csv", headers: true) do |csv|
csv.class # => CSV
csv.first # => #<CSV::Row "id":"1" "first name":"taro" "l......
require "csv"
CSV.open("test.csv", "w") do |csv|
csv << ["id", "first name", "last name", "age"]
csv << ["1", "taro", "tanaka", "20"]
csv << ["2", "jiro", "suzuki", "18"]
csv << ["3", "ami", "sato", "19"]
csv << ["4", "yumi", "adachi", "21"]
end
print File.read("test.csv")
# => id,first... -
CSV
. open(filename , mode = "rb" , options = Hash . new) {|csv| . . . } -> nil (66.0) -
このメソッドは IO オブジェクトをオープンして CSV でラップします。 これは CSV ファイルを書くための主要なインターフェイスとして使うことを意図しています。
...ック指定なし][ruby]{
require "csv"
File.write("test.csv", <<CSV)
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
CSV
csv = CSV.open("test.csv", headers: true)
csv.class # => CSV
csv.first # => #<CSV::Row "id":"1" "first name":"taro" "last name":"ta......定あり][ruby]{
require "csv"
users =<<-EOS
id,first name,last name,age
1,taro,tanaka,20
2,jiro,suzuki,18
3,ami,sato,19
4,yumi,adachi,21
EOS
File.write("test.csv", users)
CSV.open("test.csv", headers: true) do |csv|
csv.class # => CSV
csv.first # => #<CSV::Row "id":"1" "first name":"taro" "l......
require "csv"
CSV.open("test.csv", "w") do |csv|
csv << ["id", "first name", "last name", "age"]
csv << ["1", "taro", "tanaka", "20"]
csv << ["2", "jiro", "suzuki", "18"]
csv << ["3", "ami", "sato", "19"]
csv << ["4", "yumi", "adachi", "21"]
end
print File.read("test.csv")
# => id,first...