157件ヒット
[1-100件を表示]
(0.096秒)
種類
- インスタンスメソッド (77)
- 特異メソッド (44)
- ライブラリ (22)
- クラス (11)
- モジュール関数 (3)
ライブラリ
- ビルトイン (39)
- csv (22)
- date (11)
-
irb
/ context (11) - pathname (19)
-
rexml
/ document (22) - win32ole (11)
クラス
-
CSV
:: Table (22) - DateTime (11)
-
IRB
:: Context (11) - Pathname (19)
-
REXML
:: CData (11) -
REXML
:: Text (11) - Range (11)
- Symbol (14)
-
WIN32OLE
_ EVENT (11)
モジュール
- Kernel (3)
検索結果
先頭5件
-
CSV
:: Table # to _ s(options = Hash . new) -> String (18119.0) -
CSV の文字列に変換して返します。
...ションに :write_headers =>
false を指定するとヘッダを出力しません。
//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.to_csv # => "a,b,c\n1,2,3\n"
p table.to_csv(write_headers: false) # => "1,2,3\n"
//}... -
WIN32OLE
_ EVENT # handler=(obj) -> () (9118.0) -
イベント処理を実行するオブジェクトを登録します。
...はnilを指定します。
class IeHandler
def initialize
@completed = false
end
attr_reader :completed
def onDocumentComplete(disp, uri)
disp.document.getElementsByTagName('a').each do |e|
puts "#{e.innerHTML}=#{e.href}"
end
@completed = true......=#{id.to_s}, args=#{args.inspect}"
end
end
ie = WIN32OLE.new('InternetExplorer.Application.1')
event = WIN32OLE_EVENT.new(ie, 'DWebBrowserEvents2')
event.handler = IeHandler.new
ie.Navigate2 'http://www.ruby-lang.org/ja/'
loop do
break if event.handler.completed
WIN32OLE_EVE......NT.message_loop
end
ie.Quit
WIN32OLE_EVENT#on_eventなどの呼び出しでブロックが登録されている場
合、そちらが優先されます。... -
bigdecimal (6048.0)
-
bigdecimal は浮動小数点数演算ライブラリです。 任意の精度で 10 進表現された浮動小数点数を扱えます。
...bigdecimal は浮動小数点数演算ライブラリです。
任意の精度で 10 進表現された浮動小数点数を扱えます。
//emlist[][ruby]{
require 'bigdecimal'
a = BigDecimal("0.123456789123456789")
b = BigDecimal("123456.78912345678", 40)
print a + b # => 0.123456912580245903456......gDecimal)][ruby]{
require 'bigdecimal'
sum = BigDecimal("0")
for i in (1..10000)
sum = sum + BigDecimal("0.0001")
end
print sum # => 0.1e1
//}
//emlist[例3: 1.2 - 1.0 と 0.2 との比較][ruby]{
require "bigdecimal"
(BigDecimal("1.2") - BigDecimal("1.0")) == BigDecimal("0.2") # => true
(1.2......=> false
//}
=== 特別な値
正確な計算結果の提供のために、BigDecimal はいくつかの特別な値を持
ちます。
==== 無限大
BigDecimal による演算の際には無限大を表す値を返す場合があります。
//emlist[][ruby]{
require "bigdecimal"
BigDecimal("... -
Symbol (6030.0)
-
シンボルを表すクラス。シンボルは任意の文字列と一対一に対応するオブジェクトです。
...す。
シンボルオブジェクトは以下のようなリテラルで得られます。
:symbol
:'symbol'
%s!symbol! # %記法
生成されたシンボルの一覧は Symbol.all_symbols で得られます。
一番目のリテラルでシンボルを表す場合、`:' の後に
は識......対応します。
また、文字列と違い、immutable (変更不可)であり、同値ならば必ず同一です。
p "abc" == "abc" #=> true
p "abc".equal?("abc") #=> false
p :abc == :abc #=> true
p :abc.equal?(:abc) #=> true ←同値ならば同一
==== 用途
実用面では、......ではない時に用います。
* ハッシュのキー { :key => "value" }
* アクセサの引数で渡すインスタンス変数名 attr_reader :name
* メソッド引数で渡すメソッド名 __send__ :to_s
* C の enum 的な使用 (値そのものは無視してよい場合)... -
REXML
:: Text . new(arg , respect _ whitespace = false , parent = nil , raw = nil , entity _ filter = nil , illegal = REXML :: Text :: NEEDS _ A _ SECOND _ CHECK) (3339.0) -
テキストノードオブジェクトを生成します。
...使われます。
REXML::Text オブジェクトの場合はその内容が複製されます。
respect_whitespace に真を指定すると、arg に含まれる空白文字は保存されます。
偽の場合は空白はまとめられます。
raw は true, false, nil のいずれかを指定......どうかを決めます。
true の場合、そのノードは raw モードであると解釈され、
テキストにはエスケープされていないXMLマークアップは
含まれていないと仮定し、テキストの内容は変更されません。
falseの場合、そのノード......am illegal ライブラリ内部用
@raise RuntimeError テキストがXMLのテキストとして不正な
文字を含んでいる場合に発生します。
//emlist[doctype なしの場合][ruby]{
p REXML::Text.new("<&", false, nil, false).to_s # => "<&"
p REXML::Text.new("<&a... -
REXML
:: CData . new(text , respect _ whitespace = true , parent = nil) -> REXML :: CData (3225.0) -
text をテキストとして持つ CData オブジェクトを生成します。
...//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root />
EOS
doc.root.add(REXML::CData.new("foo bar baz "))
doc.to_s # => "<root><![CDATA[foo bar baz ]]></root>\n"
doc = REXML::Document.new(<<EOS)
<root />
EOS
doc.root.add(REXML::CData.new("foo bar baz ", true))
do......c.root.add(REXML::CData.new("foo bar baz ", false))
doc.to_s # => "<root><![CDATA[foo bar baz ]]><![CDATA[foo bar baz ]]></root>\n"
//}... -
Symbol
# start _ with?(*prefixes) -> bool (3152.0) -
self の先頭が prefixes のいずれかであるとき true を返します。
...elf の先頭が prefixes のいずれかであるとき true を返します。
(self.to_s.start_with?と同じです。)
@param prefixes パターンを表す文字列または正規表現 (のリスト)
@see Symbol#end_with?
@see String#start_with?
//emlist[][ruby]{
:hello.start_with?("hell"......) #=> true
:hello.start_with?(/H/i) #=> true
# returns true if one of the prefixes matches.
:hello.start_with?("heaven", "hell") #=> true
:hello.start_with?("heaven", "paradise") #=> false
//}... -
Symbol
# end _ with?(*suffixes) -> bool (3146.0) -
self の末尾が suffixes のいずれかであるとき true を返します。
...elf の末尾が suffixes のいずれかであるとき true を返します。
(self.to_s.end_with?と同じです。)
@param suffixes パターンを表す文字列 (のリスト)
@see Symbol#start_with?
@see String#end_with?
//emlist[][ruby]{
:hello.end_with?("ello") #=> true......# returns true if one of the +suffixes+ matches.
:hello.end_with?("heaven", "ello") #=> true
:hello.end_with?("heaven", "paradise") #=> false
//}... -
Kernel
. # warn(*message , uplevel: nil , category: nil) -> nil (3118.0) -
message を 標準エラー出力 $stderr に出力します。 $VERBOSE フラグ が nil のときは何も出力しません。
...nil のときは何も出力しません。
文字列以外のオブジェクトが引数として与えられた場合には、
to_s メソッドにより文字列に変換してから出力します。
uplevel を指定しない場合は、
このメソッドは以下と同じです。
//emlis......vel の例][ruby]{
def foo
warn("test message", uplevel: 0) # => test.rb:2: warning: test message
warn("test message", uplevel: 1) # => test.rb:6: warning: test message
warn("test message", uplevel: 2) # => test message
end
foo
//}
//emlist[category の例][ruby]{
Warning[:deprecated] = true......# 非推奨の警告を表示する
warn("deprecated!!", category: :deprecated)
# => deprecated!
Warning[:deprecated] = false # 非推奨の警告を表示しない
warn("deprecated!!", category: :deprecated)
# 警告は出力されない
//}
@see Warning#warn, $stderr,$VERBOSE... -
Symbol
# name -> String (3036.0) -
シンボルに対応する文字列を返します。
...シンボルに対応する文字列を返します。
Symbol#to_sと違って freeze された文字列を返します。
//emlist[][ruby]{
p :fred.name # => "fred"
p :fred.name.frozen? # => true
p :fred.to_s # => "fred"
p :fred.to_s.frozen? # => false
//}
@see Symbol#to_s... -
CSV
:: Table # to _ csv(options = Hash . new) -> String (3019.0) -
CSV の文字列に変換して返します。
...ションに :write_headers =>
false を指定するとヘッダを出力しません。
//emlist[][ruby]{
require 'csv'
csv = CSV.new("a,b,c\n1,2,3", headers: true)
table = csv.read
p table.to_csv # => "a,b,c\n1,2,3\n"
p table.to_csv(write_headers: false) # => "1,2,3\n"
//}... -
Range
. new(first , last , exclude _ end = false) -> Range (219.0) -
first から last までの範囲オブジェクトを生成して返しま す。
...first から last までの範囲オブジェクトを生成して返しま
す。
exclude_end が真ならば終端を含まない範囲オブジェクトを生
成します。exclude_end 省略時には終端を含みます。
@param first 最初のオブジェクト
@param last 最後のオブ......exclude_end 真をセットした場合終端を含まない範囲オブジェクトを生成します
@raise ArgumentError first <=> last が nil の場合に発生します
//emlist[例: 整数の範囲オブジェクトの場合][ruby]{
Range.new(1, 10) # => 1..10
Range.new(1, 10, true) #......=> 1...10
//}
//emlist[例: 日付オブジェクトの範囲オブジェクトの場合][ruby]{
require 'date'
Range.new(Date.today, Date.today >> 1).each {|d| puts d }
# => 2017-09-16
# 2017-09-17
# ...
# 2017-10-16
//}
//emlist[例: IPアドレスの範囲オブジェクトの場合][...