るりまサーチ

最速Rubyリファレンスマニュアル検索!
2266件ヒット [1-100件を表示] (0.043秒)
トップページ > クエリ:nil[x] > クエリ:end[x] > クエリ:new[x]

別のキーワード

  1. _builtin nil?
  2. nilclass nil?
  3. object nil?
  4. _builtin nil
  5. object nil

ライブラリ

キーワード

検索結果

<< 1 2 3 ... > >>

Gem::DependencyInstaller.new(options = {}) -> Gem::DependencyInstaller (21225.0)

自身を初期化します。

...s を検索します),
:both (:local, :remote の両方を検索します) のいずれかを指定可能です。
: :env_shebang
Gem::Installer.new を参照してください。
: :force
バージョンチェックとセキュリティポリシーのチェックを行わずにインストー...
...シーが指定されている場合は上記のチェックを
実行します。
: :format_executable
Gem::Installer.new を参照してください。
: :ignore_dependencies
依存している Gem をインストールしません。
: :install_dir
Gem をインストールするディ...
...シーを指定します。
: :user_install
false を指定するとユーザのホームディレクトリにインストールしません。
nil
を指定するとユーザのホームディレクトリにインストールしようとしますが、
警告を表示します。
: :wrappers...

ERB.new(str, safe_level=nil, trim_mode=nil, eoutvar=&#39;_erbout&#39;) -> ERB (18363.0)

eRubyスクリプト から ERB オブジェクトを生成して返します。

...@price = price
end


def build
b = binding
# create and run templates, filling member data variables
ERB.new(<<-'END_PRODUCT'.gsub(/^\s+/, ""), 0, "", "@product").result b
<%= PRODUCT[:name] %>
<%= PRODUCT[:desc] %>
END
_PRODUCT
ERB.new(<<-'END_PRICE'.gsub(/^\s+...
.../, ""), 0, "", "@price").result b
<%= PRODUCT[:name] %> -- <%= PRODUCT[:cost] %>
<%= PRODUCT[:desc] %>
END
_PRICE
end

end


# setup template data
listings = Listings.new
listings.build

puts listings.product + "\n" + listings.price

# Chicken Fried Steak
# A well messages pattie, bre...

Range.new(first, last, exclude_end = false) -> Range (18316.0)

first から last までの範囲オブジェクトを生成して返しま す。

...て返しま
す。

exclude_end が真ならば終端を含まない範囲オブジェクトを生
成します。exclude_end 省略時には終端を含みます。

@param first 最初のオブジェクト
@param last 最後のオブジェクト
@param exclude_end 真をセットした場合終...
...> last が nil の場合に発生します

//emlist[例: 整数の範囲オブジェクトの場合][ruby]{
Range.new(1, 10) # => 1..10
Range.new(1, 10, true) # => 1...10
//}

//emlist[例: 日付オブジェクトの範囲オブジェクトの場合][ruby]{
require 'date'
Range.new(Date.toda...
...ire '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
//}

//emlist[例: 自作のオブジェクトの場合][ruby]{
MyInteger = Struct.new(:value) do
def succ
self.class.new(value + 1)
end


def <=>(other)...

Rake::PackageTask.new(name = nil, version = nil) {|t| ... } -> Rake::PackageTask (18315.0)

自身を初期化してタスクを定義します。

...]{
# Rakefile での記載例とする
require 'rake/packagetask'

Rake::PackageTask.new("sample", "1.0.0") do |package_task|
package_task.package_dir = "./pkg"
package_task.package_files.include("lib/**/*")
end


# rake -T を実行すると以下になる
# => rake clobber_package # Remove pac...

ERB.new(str, safe_level=NOT_GIVEN, trim_mode=NOT_GIVEN, eoutvar=NOT_GIVEN, trim_mode: nil, eoutvar: &#39;_erbout&#39;) -> ERB (18262.0)

eRubyスクリプト から ERB オブジェクトを生成して返します。

...product
@price = price
end


def build
b = binding
# create and run templates, filling member data variables
ERB.new(<<~'END_PRODUCT', eoutvar: "@product").result b
<%= PRODUCT[:name] %>
<%= PRODUCT[:desc] %>
END
_PRODUCT
ERB.new(<<~'END_PRICE', eoutvar: "@price...
...").result b
<%= PRODUCT[:name] %> -- <%= PRODUCT[:cost] %>
<%= PRODUCT[:desc] %>
END
_PRICE
end

end


# setup template data
listings = Listings.new
listings.build

puts listings.product + "\n" + listings.price

# Chicken Fried Steak
# A well messages pattie, breaded and fried.
#
# C...

絞り込み条件を変える

ERB.new(str, trim_mode: nil, eoutvar: &#39;_erbout&#39;) -> ERB (18262.0)

eRubyスクリプト から ERB オブジェクトを生成して返します。

...product
@price = price
end


def build
b = binding
# create and run templates, filling member data variables
ERB.new(<<~'END_PRODUCT', eoutvar: "@product").result b
<%= PRODUCT[:name] %>
<%= PRODUCT[:desc] %>
END
_PRODUCT
ERB.new(<<~'END_PRICE', eoutvar: "@price...
...").result b
<%= PRODUCT[:name] %> -- <%= PRODUCT[:cost] %>
<%= PRODUCT[:desc] %>
END
_PRICE
end

end


# setup template data
listings = Listings.new
listings.build

puts listings.product + "\n" + listings.price

# Chicken Fried Steak
# A well messages pattie, breaded and fried.
#
# C...

Enumerator::Lazy.new(obj, size=nil) {|yielder, *values| ... } -> Enumerator::Lazy (18244.0)

Lazy Enumerator を作成します。Enumerator::Lazy#force メソッドなどに よって列挙が実行されたとき、objのeachメソッドが実行され、値が一つずつ ブロックに渡されます。ブロックは、yielder を使って最終的に yield される値を 指定できます。

...dule Enumerable
def filter_map(&block)
map(&block).compact
end

end


class Enumerator::Lazy
def filter_map
Lazy.new(self) do |yielder, *values|
result = yield *values
yielder << result if result
end

end

end


1.step.lazy.filter_map{|i| i*i if i.even?}.first(5)
# =>...
...[4, 16, 36, 64, 100]
//}

@raise ArgumentError 引数を指定しなかった場合、ブロックを指定しなかった場合に発生します。

@see Enumerator.new...

CSV.new(data, options = Hash.new) -> CSV (18226.0)

このメソッドは CSV ファイルを読み込んだり、書き出したりするために String か IO のインスタンスをラップします。

...r" の並びまでを読みます。
A sequence will be selected even if it occurs in a quoted field, assuming that you
would have the same line endings there. If none of those sequences is
found, +data+ is ARGF, Object::STDIN, Object::STDOUT, or
Object::STDERR, or the stream is only avail...
...limit to
prevent what are effectively DoS attacks on the parser. However, this
limit can cause a legitimate parse to fail and thus is set to +nil+, or off,
by default.
: :converters
CSV::Converters から取り出した名前の配列です。変換器が一つだけ
の場合は配列...
...EOS

File.write("test.csv", users)

File.open("test.csv", "r") do |f|
csv = CSV.new(f, headers: true)
csv.class # => CSV
csv.first # => #<CSV::Row "id":"1" "first name":"taro" "last name":"tanaka" "age":"20">
end

//}

//emlist[例 文字列の読み込み][ruby]{
require "csv"

users =<<-EOS
i...

Rake::TaskArguments.new(names, values, parent = nil) (18220.0)

自身を初期化します。

...記載例とする

task default: :test_rake_app
task :test_rake_app do
arguments1 = Rake::TaskArguments.new(["name1", "name2"], ["value1", "value2"])
arguments2 = Rake::TaskArguments.new(["name3", "name4"], ["value3", "value4"], arguments1)
p arguments1 # => #<Rake::TaskArguments name1: value...
...1, name2: value2>
p arguments2 # => #<Rake::TaskArguments name3: value3, name4: value4>
p arguments2["name1"] # => "value1"
p arguments2["name3"] # => "value3"
end

//}...

OptionParser.new(banner = nil, width = 32, indent = &#39; &#39; * 4) -> OptionParser (18216.0)

OptionParser オブジェクトを生成して返します。

...まり、以下のような書き方が可能です。

//emlist[][ruby]{
require 'optparse'
OptionParser.new do |opt|

opt.on('-a') {|v| p v }
opt.on('-b') {|v| p v }

opt.parse!(ARGV)
end

//}

@param banner ヘルプ(サマリ)の最初の部分に表示される、アプリケーション...

絞り込み条件を変える

OptionParser.new(banner = nil, width = 32, indent = &#39; &#39; * 4) {|opt| ...} -> OptionParser (18216.0)

OptionParser オブジェクトを生成して返します。

...まり、以下のような書き方が可能です。

//emlist[][ruby]{
require 'optparse'
OptionParser.new do |opt|

opt.on('-a') {|v| p v }
opt.on('-b') {|v| p v }

opt.parse!(ARGV)
end

//}

@param banner ヘルプ(サマリ)の最初の部分に表示される、アプリケーション...

WEBrick::HTTPProxyServer.new(config, default = WEBrick::Config::HTTP) -> WEBrick::HTTPProxyServer (18155.0)

プロクシオブジェクトを生成して返します。

...定を保存したハッシュを指定します。
設定として有効なハッシュのキーとその値は WEBrick::HTTPServer.new と同じです。
それに加えて以下のキーが有効です。

: :ProxyAuthProc
プロクシ認証を行う Proc オブジ...
...
認証に失敗した場合 proc は適切な例外を発生させなければいけません。nil を指定した場合すべての接続を
受け付けます。デフォルトは nil です。通常は WEBrick::HTTPAuth::ProxyBasicAuth か
WEBrick::HTTPAuth::ProxyDigestAuth を使用...
...xy-Authenticate'] = 'Basic realm="WEBrick Proxy"'
raise WEBrick::HTTPStatus::ProxyAuthenticationRequired
else
# 略
end

}
s = WEBrick::HTTPProxyServer.new(ProxyAuthProc: auth_proc, Port: 8080)
//}
: :ProxyContentHandler
接続先の HTTP サーバからの内容を処理する Pr...
<< 1 2 3 ... > >>