610件ヒット
[1-100件を表示]
(0.152秒)
別のキーワード
クラス
- Array (28)
- BasicObject (24)
- CSV (12)
- Class (12)
- Data (6)
- Integer (24)
- MatchData (12)
- Matrix (48)
- Module (23)
- Object (78)
- OptionParser (24)
- Regexp (12)
-
RubyVM
:: AbstractSyntaxTree :: Node (7) -
RubyVM
:: InstructionSequence (72) - SignalException (12)
- String (12)
- StringScanner (12)
- Struct (24)
- Thread (24)
-
Thread
:: Backtrace :: Location (36) -
Thread
:: ConditionVariable (24) - ThreadGroup (12)
- UnboundMethod (12)
-
WIN32OLE
_ TYPE (12)
モジュール
- Enumerable (48)
キーワード
- ! (12)
- != (12)
-
absolute
_ path (24) - add (12)
-
alias
_ method (8) -
base
_ label (24) -
bind
_ call (12) - broadcast (12)
-
const
_ added (3) - deconstruct (3)
-
deconstruct
_ keys (3) -
default
_ event _ sources (12) - disasm (12)
- disassemble (12)
- each (72)
-
each
_ with _ index (24) -
enum
_ for (24) - inherited (12)
-
initialize
_ copy (12) - inspect (19)
- label (12)
-
max
_ by (48) -
on
_ head (12) -
on
_ tail (12) - path (12)
- run (12)
- signal (12)
- signm (12)
- taint (6)
- tap (12)
- times (24)
-
to
_ csv (4) -
to
_ enum (24) -
to
_ s (12) -
undef
_ method (12) - unscan (12)
- upto (12)
- wakeup (12)
- ~ (12)
検索結果
先頭5件
-
CSV
# puts(row) -> self (18323.0) -
自身に row を追加します。
...ist[例 配列を指定][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.open("test.csv", "a") do |csv|
csv.puts(["5", "saburo", "kondo", "34"])
end
print File.read("test.csv")
# => id,first n......ame,last name,age
# 1,taro,tanaka,20
# 2,jiro,suzuki,18
# 3,ami,sato,19
# 4,yumi,adachi,21
# 5,saburo,kondo,34
//}
//emlist[例 CSV::Row を指定][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,a......21
CSV
CSV.open("test.csv", "a") do |csv|
row = CSV::Row.new(["id", "first name", "last name", "age"], ["5", "saburo", "kondo", "34"])
csv.add_row(row)
end
print File.read("test.csv")
# => "id", first name,last name,age
# 1,taro,tanaka,20
# 2,jiro,suzuki,18
# 3,ami,sato,19
# 4,yumi,... -
RubyVM
:: AbstractSyntaxTree :: Node # inspect -> String (12129.0) -
self のデバッグ用の情報を含んだ文字列を返します。
...
self のデバッグ用の情報を含んだ文字列を返します。
//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 1')
puts node.inspect
# => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-1:5>
//}... -
WIN32OLE
_ TYPE # default _ event _ sources -> [WIN32OLE _ TYPE] (9249.0) -
型が持つソースインターフェイスを取得します。
...す。
default_event_sourcesメソッドは、selfがCoClass(コンポーネントクラス)
の場合、そのクラスがサポートするデフォルトのソースインターフェイス(イ
ベントの通知元となるインターフェイス)を返します。
@return デフォ......TYPEの配列と
して返します。返すのは配列ですが、デフォルトのソースインターフェ
イスは最大でも1インターフェイスです。ソースインターフェイスを持
たない場合は空配列を返します。
tobj = WIN32OLE_T......YPE.new('Microsoft Excel 14.0 Object Library', 'Worksheet')
tobj.default_event_sources.map {|intf| intf.name} #=> ["DocEvents"]
WIN32OLE_EVENT.newでインターフェイス名を指定しない場合は、ここで
返されたインターフェイスが選択されます。
次のサンプル... -
RubyVM
:: InstructionSequence # path -> String (9135.0) -
self が表す命令シーケンスの相対パスを返します。
...
self が表す命令シーケンスの相対パスを返します。
self の作成時に指定した文字列を返します。self を文字列から作成していた
場合は "<compiled>" を返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1......)
# => <RubyVM::InstructionSequence:<compiled>@<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 RubyVM::InstructionSequence#absolute_path... -
RubyVM
:: InstructionSequence # absolute _ path -> String | nil (9129.0) -
self が表す命令シーケンスの絶対パスを返します。
...
self が表す命令シーケンスの絶対パスを返します。
self を文字列から作成していた場合は nil を返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
i......lute_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"
@see RubyVM::Instructi......onSequence#path... -
Thread
:: Backtrace :: Location # absolute _ path -> String (9129.0) -
self が表すフレームの絶対パスを返します。
...
self が表すフレームの絶対パスを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end
# => /path/to/foo.rb
# /path....../to/foo.rb
# /path/to/foo.rb
//}
@see Thread::Backtrace::Location#path... -
Object
# tap {|x| . . . } -> self (6270.0) -
self を引数としてブロックを評価し、self を返します。
...
self を引数としてブロックを評価し、self を返します。
メソッドチェインの途中で直ちに操作結果を表示するために
メソッドチェインに "入り込む" ことが、このメソッドの主目的です。
//emlist[][ruby]{
(1..10) .ta......p {|x| puts "original: #{x}" }
.to_a .tap {|x| puts "array: #{x}" }
.select {|x| x.even? } .tap {|x| puts "evens: #{x}" }
.map {|x| x*x } .tap {|x| puts "squares: #{x}" }
//}......p {|x| puts "original: #{x}" }
.to_a .tap {|x| puts "array: #{x}" }
.select {|x| x.even? } .tap {|x| puts "evens: #{x}" }
.map {|x| x*x } .tap {|x| puts "squares: #{x}" }
//}
@see Object#yield_self... -
Integer
# times {|n| . . . } -> self (6258.0) -
self 回だけ繰り返します。 self が正の整数でない場合は何もしません。
...
self 回だけ繰り返します。
self が正の整数でない場合は何もしません。
またブロックパラメータには 0 から self - 1 までの数値が渡されます。
//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.t......imes { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}
@see Integer#upto, Integer#downto, Numeric#step... -
Object
# taint -> self (6246.0) -
このメソッドは Ruby 2.7 から deprecated で、Ruby 3.2 で削除予定です。
...このメソッドは Ruby 2.7 から deprecated で、Ruby 3.2 で削除予定です。
オブジェクトの「汚染マーク」をセットします。
環境変数(ENVで得られる文字列)など一部のオブジェクトは最初から汚染されています。
オブジェクト......st[][ruby]{
$SAFE = 1
some = "puts '@&%&(#!'"
p some.tainted? #=> false
eval(some) #=> @&%&(#!
some.taint
p some.tainted? #=> true
eval(some) # Insecure operation - eval (SecurityError)
some.untaint
p some.tainted? #=> false
eval(some) #=> @&%&(#!
p ENV['OS'].tainted? #=> true
//}
@see Object#t......ainted?,Object#untaint,Object#freeze... -
Module
# undef _ method(*name) -> self (6238.0) -
このモジュールのインスタンスメソッド name を未定義にします。
...このモジュールのインスタンスメソッド name を未定義にします。
@param name 0 個以上の String か Symbol を指定します。
@raise NameError 指定したインスタンスメソッドが定義されていない場合に発生します。
=== 「未定義にする......い。
//emlist[例][ruby]{
class A
def ok
puts 'A'
end
end
class B < A
def ok
puts 'B'
end
end
B.new.ok # => B
# undef_method の場合はスーパークラスに同名のメソッドがあっても
# その呼び出しはエラーになる
class B
undef_method :ok
end
B.new.......ve_method の場合はスーパークラスに同名のメソッドがあると
# それが呼ばれる
class B
remove_method :ok
end
B.new.ok # => A
//}
また、undef 文と undef_method の違いは、
メソッド名を String または Symbol で与えられることです。
//emlist[例...