1122件ヒット
[201-300件を表示]
(0.153秒)
ライブラリ
- ビルトイン (788)
- csv (126)
- date (4)
- forwardable (24)
-
rexml
/ document (180)
クラス
- Array (72)
- CSV (96)
-
CSV
:: FieldInfo (24) -
CSV
:: Row (6) - Date (2)
- DateTime (2)
-
Enumerator
:: Lazy (90) -
File
:: Stat (12) - Object (48)
-
REXML
:: Attributes (144) -
REXML
:: Element (36) - Range (118)
-
RubyVM
:: AbstractSyntaxTree :: Node (14) -
RubyVM
:: InstructionSequence (24) - String (216)
-
Thread
:: Backtrace :: Location (36) - Time (2)
モジュール
- Enumerable (156)
- Forwardable (24)
キーワード
- <=> (12)
- [] (84)
- []= (36)
- attribute (12)
- begin (12)
-
chunk
_ while (12) -
col
_ sep (12) - convert (36)
- deconstruct (3)
-
deconstruct
_ keys (9) - delegate (12)
- delete (12)
-
delete
_ all (12) - each (12)
-
each
_ attribute (12) - eager (6)
- end (12)
-
enum
_ for (48) -
first
_ column (7) -
first
_ lineno (19) -
get
_ attribute (12) -
get
_ attribute _ ns (12) - header (12)
-
header
_ convert (36) - index (12)
- inject (36)
-
instance
_ delegate (12) - label (12)
- last (48)
- lazy (12)
- length (12)
- lineno (12)
- min (46)
- namespaces (12)
- path (12)
- prefixes (12)
- puts (12)
- reduce (36)
- root (12)
-
root
_ node (12) - size (12)
- slice (72)
- slice! (72)
-
slice
_ before (24) -
slice
_ when (12) - take (12)
-
take
_ while (24) -
to
_ a (12) -
to
_ enum (48)
検索結果
先頭5件
-
Object
# to _ enum(method = :each , *args) {|*args| . . . } -> Enumerator (6219.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......。
//emlist[][ruby]{
str = "xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumer......able
def repeat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
e... -
REXML
:: Element # root -> REXML :: Element (6219.0) -
self が属する文書のルート要素を返します。
...//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root>
<children>
<grandchildren />
</children>
</root>
EOS
children = doc.get_elements("/root/children").first
children.name # => "children"
children.root.name # => "root"
grandchildren = doc.get_elements("/root/childre......n/grandchildren").first
grandchildren.name # => "grandchildren"
grandchildren.root.name # => "root"
//}... -
Array
# last -> object | nil (6215.0) -
配列の末尾の要素を返します。配列が空のときは nil を返します。
...配列の末尾の要素を返します。配列が空のときは nil を返します。
//emlist[例][ruby]{
p [0, 1, 2].last #=> 2
p [].last #=> nil
//}
@see Array#first... -
Enumerable
# inject(init = self . first) {|result , item| . . . } -> object (6215.0) -
リストのたたみこみ演算を行います。
...リストのたたみこみ演算を行います。
最初に初期値 init と self の最初の要素を引数にブロックを実行します。
2 回目以降のループでは、前のブロックの実行結果と
self の次の要素を引数に順次ブロックを実行します。
そ......て最後の要素まで繰り返し、最後のブロックの実行結果を返します。
要素が存在しない場合は init を返します。
初期値 init を省略した場合は、
最初に先頭の要素と 2 番目の要素をブロックに渡します。
また要素が 1 つし......クを実行せずに最初の要素を返します。
要素がなければブロックを実行せずに nil を返します。
@param init 最初の result の値です。任意のオブジェクトが渡せます。
@param sym ブロックの代わりに使われるメソッド名を表す S... -
REXML
:: Attributes # delete(attribute) -> REXML :: Element (6213.0) -
指定した属性を取り除きます。
...attribute で取り除く属性を指定します。
文字列もしくは REXML::Attribute オブジェクトを指定します
self が属する要素(REXML::Element)を返します。
@param attribute 取り除く属性(文字列もしくは REXML::Attribute オブジェクト)
//emlist[][ruby......ent'
doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
a.attributes.delete("att") # => <a foo:att='1' bar:att='2'/>
a.attributes.delete......("foo:att") # => <a bar:att='2'/>
attr = a.attributes.get_attribute("bar:att")
a.attributes.delete(attr) # => <a/>
//}... -
REXML
:: Attributes # delete _ all(name) -> [REXML :: Attribute] (6213.0) -
name という名前を持つ属性をすべて削除します。
...mlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
a.attributes.delete_all("att") # => [att='<']......a # => <a foo:att='1' bar:att='2'/>
//}... -
REXML
:: Element # attribute(name , namespace = nil) -> REXML :: Attribute | nil (6213.0) -
name で指定される属性を返します。
...name で指定される属性を返します。
属性は REXML::Attribute オブジェクトの形で返します。
name は "foo:bar" のように prefix を指定することができます。
namespace で名前空間の URI を指定することで、その名前空間内で
name という......ist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root/a").first
a.attribute("att") # => att='<'
a.attribute("att"......, "http://example.org/bar") # => bar:att='2'
a.attribute("bar:att") # => bar:att='2'
a.attribute("baz") # => nil
//}... -
Time
# deconstruct _ keys(array _ of _ names _ or _ nil) -> Hash (6149.0) -
パターンマッチに使用する名前と値の Hash を返します。
...month
* :day
* :yday
* :wday
* :hour
* :min
* :sec
* :subsec
* :dst
* :zone
@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。
//emlist[例][ruby]{
t = Time.utc(2......if t in wday: 3, day: ..7 # deconstruct_keys が使われます
puts "first Wednesday of the month"
end
#=> "first Wednesday of the month" が出力される
case t
in year: ...2022
puts "too old"
in month: ..9
puts "quarter 1-3"
in wday: 1..5, month:
puts "working day in month #{month}"......end
#=> "working day in month 10" が出力される
# クラスのチェックと組み合わせて利用することもできます
if t in Time(wday: 3, day: ..7)
puts "first Wednesday of the month"
end
//}
@see d:spec/pattern_matching#matching_non_primitive_objects... -
CSV
# header _ convert {|field , field _ info| . . . } (6125.0) -
CSV#convert に似ていますが、ヘッダ行用のメソッドです。
...CSV#convert に似ていますが、ヘッダ行用のメソッドです。
このメソッドはヘッダ行を読み込む前に呼び出さなければなりません。
@param name 変換器の名前を指定します。
//emlist[例 name を指定][ruby]{
require "csv"
csv = CSV.new("heade......1,row1_2", headers: true)
csv.header_convert(:symbol)
csv.first.headers # => [:header1, :header2]
//}
//emlist[例 ブロックを指定][ruby]{
require "csv"
csv = CSV.new("header1,header2\nrow1_1,row1_2", headers: true)
csv.header_convert do |field|
field.to_sym
end
csv.first.headers # => [:he......ader1, :header2]
//}
@see CSV#header_converters, CSV#convert... -
CSV
# header _ convert {|field| . . . } (6125.0) -
CSV#convert に似ていますが、ヘッダ行用のメソッドです。
...CSV#convert に似ていますが、ヘッダ行用のメソッドです。
このメソッドはヘッダ行を読み込む前に呼び出さなければなりません。
@param name 変換器の名前を指定します。
//emlist[例 name を指定][ruby]{
require "csv"
csv = CSV.new("heade......1,row1_2", headers: true)
csv.header_convert(:symbol)
csv.first.headers # => [:header1, :header2]
//}
//emlist[例 ブロックを指定][ruby]{
require "csv"
csv = CSV.new("header1,header2\nrow1_1,row1_2", headers: true)
csv.header_convert do |field|
field.to_sym
end
csv.first.headers # => [:he......ader1, :header2]
//}
@see CSV#header_converters, CSV#convert...