要約
Gem パッケージのメタデータを扱うためのクラスです。
目次
- 特異メソッド
-
- _load
- add_spec
- all
- all=
- all_names
- array_attributes
- attribute_names
- dirs
- dirs=
- each
- find_all_by_full_name
- find_all_by_name
- find_by_full_name
- find_by_name
- find_by_path
- find_inactive_by_path
- from_yaml
- latest_spec_for
- latest_specs
- load
- normalize_yaml_input
- outdated
- outdated_and_latest_version
- remove_spec
- required_attribute?
- required_attributes
- reset
- stubs
- stubs_for
- インスタンスメソッド
-
- _dump
- activate
- activated?
- add_bindir
- add_dependency
- add_development_dependency
- add_runtime_dependency
- author
- author=
- authors
- authors=
- autorequire
- autorequire=
- base_dir
- bin_dir
- bin_file
- bindir
- bindir=
- build_args
- cache_dir
- cache_file
- cert_chain
- cert_chain=
- conflicts
- date
- date=
- dependencies
- dependent_gems
- dependent_specs
- description
- description=
- development_dependencies
- doc_dir
- email=
- executable
- executable=
- executables
- executables=
- extension_dir
- extensions
- extensions=
- extensions_dir
- extra_rdoc_files
- extra_rdoc_files=
- file_name
- files
- files=
- full_gem_path
- full_name
- gem_dir
- gems_dir
- has_conflicts?
- has_test_suite?
- has_unit_tests?
- homepage
- homepage=
- lib_files
- license
- license=
- licenses
- licenses=
- loaded_from
- loaded_from=
- metadata
- metadata=
- missing_extensions?
- name
- name=
- name_tuple
- normalize
- original_name
- original_platform
- original_platform=
- platform
- platform=
- post_install_message
- post_install_message=
- rdoc_options
- rdoc_options=
- require_path
- require_path=
- require_paths
- require_paths=
- required_ruby_version
- required_ruby_version=
- required_rubygems_version
- required_rubygems_version=
- requirements
- requirements=
- ri_dir
- rubygems_version
- rubygems_version=
- runtime_dependencies
- satisfies_requirement?
- signing_key
- signing_key=
- spec_dir
- spec_file
- spec_name
- specification_version
- specification_version=
- stubbed?
- summary
- summary=
- test_file
- test_file=
- test_files
- test_files=
- to_ruby
- to_spec
- validate
- version
- version=
- yaml_initialize
- 定数
特異メソッド
_load(str) -> Gem::SpecificationRuby 1.9.3 から[permalink][rdoc][edit]-
マーシャルされたデータをロードするためのメソッドです。
- [PARAM]
str: - マーシャルされたデータを指定します。
- [PARAM]
add_spec(spec) -> ()Ruby 3.2 から[permalink][rdoc][edit]-
既知の仕様書の一覧に
specを追加します。追加後、一覧はソートされた状態に保たれます。
- [PARAM]
spec: - 追加する Gem::Specification を指定します。
spec = Gem::Specification.new { |s| s.name = "rfoo_unique_test"; s.version = "1.0" } p Gem::Specification.all_names.include?("rfoo_unique_test-1.0") # => false Gem::Specification.add_spec(spec) p Gem::Specification.all_names.include?("rfoo_unique_test-1.0") # => true Gem::Specification.remove_spec(spec) p Gem::Specification.all_names.include?("rfoo_unique_test-1.0") # => false[SEE_ALSO] Gem::Specification.remove_spec
- [PARAM]
all -> [Gem::Specification]Ruby 1.9.3 から[permalink][rdoc][edit]-
既知の全ての仕様書を返します。
このメソッドの利用は推奨されません。
Gem::SpecificationはEnumerableを extend しているため、代わりに Gem::Specification.each などのEnumerableのメソッドを使ってください。[SEE_ALSO] Gem::Specification.each
all=(specs)Ruby 1.9.3 から[permalink][rdoc][edit]-
既知の仕様書の一覧を
specsにセットします。- [PARAM]
specs: - 仕様書の一覧として設定する Gem::Specification の配列を指定します。
[SEE_ALSO] Gem::Specification.all
- [PARAM]
all_names -> [String]Ruby 1.9.3 から[permalink][rdoc][edit]-
既知の全ての仕様書の Gem::Specification#full_name をソートした配列で返します。
array_attributes -> ArrayRuby 1.9.3 から[permalink][rdoc][edit]-
@@array_attributes の複製を返します。
[SEE_ALSO] Object#dup
attribute_names -> ArrayRuby 1.9.3 から[permalink][rdoc][edit]-
属性名の配列を返します。
dirs -> [String]Ruby 1.9.3 から[permalink][rdoc][edit]-
Gem::Specificationが仕様書を探すディレクトリの一覧を返します。[SEE_ALSO] Gem::Specification.dirs=
dirs=(dirs)Ruby 1.9.3 から[permalink][rdoc][edit]-
Gem::Specificationが仕様書を探すディレクトリをdirsにセットします。このメソッドを呼ぶと、既知の仕様書の一覧はリセットされます。
- [PARAM]
dirs: - 仕様書を探すディレクトリの配列を指定します。
[SEE_ALSO] Gem::Specification.dirs, Gem::Specification.reset
- [PARAM]
each {|spec| ... } -> [Gem::Specification]Ruby 1.9.3 から[permalink][rdoc][edit]each -> Enumerator-
既知の仕様書 1 つ 1 つに対してブロックを評価します。
ブロックを省略した場合は
Enumeratorを返します。[SEE_ALSO] Gem::Specification.dirs=
find_all_by_full_name(full_name) -> [Gem::Specification]Ruby 2.5.0 から[permalink][rdoc][edit]-
指定した
full_nameを持つ全ての仕様書を返します。- [PARAM]
full_name: - 探す仕様書の Gem::Specification#full_name を文字列で指定します。
[SEE_ALSO] Gem::Specification.find_by_full_name
- [PARAM]
find_all_by_name(name, *requirements) -> [Gem::Specification]Ruby 1.9.3 から[permalink][rdoc][edit]-
指定した
nameとrequirementsにマッチする全ての仕様書を返します。- [PARAM]
name: - 探す gem の名前を指定します。
- [PARAM]
requirements: - バージョンの必要条件を 0 個以上指定します。省略した場合は全てのバージョンにマッチします。
[SEE_ALSO] Gem::Specification.find_by_name
- [PARAM]
find_by_full_name(full_name) -> Gem::Specification | nilRuby 3.3 から[permalink][rdoc][edit]-
指定した
full_nameにもっとも合致する仕様書を返します。見つからなかった場合は nil を返します。
- [PARAM]
full_name: - 探す仕様書の Gem::Specification#full_name を文字列で指定します。
[SEE_ALSO] Gem::Specification.find_all_by_full_name
- [PARAM]
find_by_name(name, *requirements) -> Gem::SpecificationRuby 1.9.3 から[permalink][rdoc][edit]-
指定した
nameとrequirementsにもっとも合致する仕様書を返します。- [PARAM]
name: - 探す gem の名前を指定します。
- [PARAM]
requirements: - バージョンの必要条件を 0 個以上指定します。省略した場合は全てのバージョンにマッチします。
- [EXCEPTION]
Gem::MissingSpecError: -
nameを持つ gem が 1 つもインストールされていない場合に発生します。 - [EXCEPTION]
Gem::MissingSpecVersionError: -
nameを持つ gem はインストールされているものの、requirementsを満たすバージョンが無い場合に発生します。
[SEE_ALSO] Gem::Specification.find_all_by_name
- [PARAM]
find_by_path(path) -> Gem::Specification | nilRuby 1.9.3 から[permalink][rdoc][edit]-
指定した
pathにマッチするファイルを含む、もっとも合致する仕様書を返します。見つからなかった場合は nil を返します。
- [PARAM]
path: - 探すファイルのパスを指定します。
[SEE_ALSO] Gem::Specification.find_inactive_by_path
- [PARAM]
find_inactive_by_path(path) -> Gem::Specification | nilRuby 2.0.0 から[permalink][rdoc][edit]-
指定した
pathにマッチするファイルを含む仕様書のうち、まだ activate されていないものの中からもっとも合致するものを返します。見つからなかった場合は nil を返します。
- [PARAM]
path: - 探すファイルのパスを指定します。
[SEE_ALSO] Gem::Specification.find_by_path, Gem::Specification#activated?
- [PARAM]
from_yaml(input) -> Gem::SpecificationRuby 1.9.3 から[permalink][rdoc][edit]-
YAML ファイルから gemspec をロードします。
YAML ファイルから Gem::Specification をロードすると、通常の Ruby オブジェクトの初期化ルーチン (#initialize) を通りません。このメソッドは初期化ルーチンの一部を実行し、 gemspec のバージョンチェックも行います。
- [PARAM]
input: - 文字列か IO オブジェクトを指定します。
- [PARAM]
latest_spec_for(name) -> Gem::Specification | nilRuby 3.0 から[permalink][rdoc][edit]-
指定した
nameを持つ gem のうち、インストールされている最新の仕様書を返します。見つからなかった場合は nil を返します。
- [PARAM]
name: - 探す gem の名前を指定します。
[SEE_ALSO] Gem::Specification.latest_specs
- [PARAM]
latest_specs(prerelease = false) -> [Gem::Specification]Ruby 1.9.3 から[permalink][rdoc][edit]-
インストールされている最新の仕様書の一覧を返します。
- [PARAM]
prerelease: - true を指定するとプレリリース版の仕様書も対象に含めます。
[SEE_ALSO] Gem::Specification.latest_spec_for
- [PARAM]
load(filename) -> Gem::SpecificationRuby 1.9.3 から[permalink][rdoc][edit]-
gemspec ファイルをロードします。
- [PARAM]
filename: - gemspec のファイル名を指定します。
- [EXCEPTION]
StandardError: - gemspec ファイル内でこのメソッドを呼んでいる場合に発生します。
- [PARAM]
normalize_yaml_input(input) -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
YAML 形式の gemspec を正しくフォーマットします。
- [PARAM]
input: - 文字列か IO オブジェクトを指定します。
- [PARAM]
outdated -> [String]Ruby 1.9.3 から[permalink][rdoc][edit]-
古くなっているローカルの gem の名前の一覧を返します。
このメソッドはサーバへ問い合わせて仕様書を取得する必要があるため負荷が高い処理です。最新のリモートバージョンも合わせて取得したい場合は Gem::Specification.outdated_and_latest_version を使ってください。
outdated_and_latest_version {|local_spec, latest_version| ... } -> nilRuby 2.1.0 から[permalink][rdoc][edit]outdated_and_latest_version -> Enumerator-
古くなっているローカルの gem について、ローカルの仕様書と最新のリモートバージョンをブロックに渡して評価します。
サーバの索引に対して 1 つ 1 つのローカル gem を問い合わせるため、返るまでに時間がかかることがあります。ブロックを省略した場合は
Enumeratorを返します。[SEE_ALSO] Gem::Specification.outdated
remove_spec(spec) -> ()Ruby 3.2 から[permalink][rdoc][edit]-
既知の仕様書の一覧から
specを削除します。- [PARAM]
spec: - 削除する Gem::Specification を指定します。
[SEE_ALSO] Gem::Specification.add_spec
- [PARAM]
required_attribute?(name) -> boolRuby 1.9.3 から[permalink][rdoc][edit]-
必須属性であれば真を返します。
- [PARAM]
name: - 属性名を指定します。
- [PARAM]
required_attributes -> ArrayRuby 1.9.3 から[permalink][rdoc][edit]-
必須属性のリストを返します。
reset -> ()Ruby 1.9.3 から[permalink][rdoc][edit]-
既知の仕様書の一覧をリセットします。
リセットの前後で、
Gemに登録された reset 前後のフック (Gem.pre_reset_hooks・Gem.post_reset_hooks)を実行します。[SEE_ALSO] Gem::Specification.dirs=
stubs -> ArrayRuby 3.0 から[permalink][rdoc][edit]-
インストールされている全ての Gem の情報を、Gem::StubSpecification(gemspec ファイルの内容を遅延読み込みする軽量なスタブオブジェクト)の配列として返します。
例Gem::Specification.listとは異なり、gemspec ファイルの内容を実際に読み込まずにスタブを生成するため、高速に動作します。p Gem::Specification.stubs.first(3).map(&:class) # => [Gem::StubSpecification, Gem::StubSpecification, Gem::StubSpecification] p Gem::Specification.stubs.first.name # => "abbrev"[SEE_ALSO] Gem::Specification.stubs_for
stubs_for(name) -> ArrayRuby 3.0 から[permalink][rdoc][edit]-
指定した名前を持つ Gem の Gem::StubSpecification の配列を返します。
Gem::Specification.stubs と同様、gemspec ファイルの内容を遅延読み込みするスタブオブジェクトを返すため高速に動作します。
- [PARAM]
name: - Gem の名前を文字列で指定します。
p Gem::Specification.stubs_for("abbrev").map(&:name) # => ["abbrev"][SEE_ALSO] Gem::Specification.stubs
- [PARAM]
インスタンスメソッド
_dump -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
重要なインスタンス変数のみを Marshal?.dump します。
[SEE_ALSO] Marshal?.dump
activate -> boolRuby 1.9.3 から[permalink][rdoc][edit]-
selfを activate します。selfを「ロード済みの仕様書」として登録し、Gem::Specification#require_paths を$LOAD_PATHに追加します。同じ名前の gem が既に activate 済みの場合、バージョンが
selfと同じであれば何もせずfalseを返します。バージョンが異なる場合は例外が発生します。まだ同じ名前の gem が activate されていない場合は、依存関係の競合が無いことを確認したうえで activate を行いtrueを返します。- [RETURN]
-
activate を行った場合は
trueを、同じバージョンで既に activate 済みだった場合はfalseを返します。 - [EXCEPTION]
Gem::LoadError: -
selfとは異なるバージョンの同名の gem が既に activate 済みの場合に発生します。 - [EXCEPTION]
Gem::ConflictError: - 依存関係の競合がある場合に発生します。
[SEE_ALSO] Gem::Specification#activated?
activated? -> boolRuby 1.9.3 から[permalink][rdoc][edit]-
selfが activate 済みであれば true を返します。この属性は永続化されません。
[SEE_ALSO] Gem::Specification#activate
add_bindir(executables) -> Array | nilRuby 1.9.3 から[permalink][rdoc][edit]-
実行コマンドの格納場所を返します。
- [PARAM]
executables: - 実行コマンド名を格納した配列を指定します。
- [PARAM]
add_dependency(gem, *requirements) -> [Gem::Dependency]Ruby 1.9.3 から[permalink][rdoc][edit]add_runtime_dependency(gem, *requirements) -> [Gem::Dependency]-
この gem の RUNTIME 依存性を追加します。実行時に必要となる gem を指定します。
# https://github.com/rurema/bitclust/blob/v1.2.3/bitclust-core.gemspec#L25 s.add_runtime_dependency "progressbar", ">= 1.9.0", "< 2.0"- [PARAM]
gem: - 依存する gem の名前か Gem::Dependency のインスタンスを指定します。
- [PARAM]
requirements: - バージョンの必要条件を 0 個以上指定します。デフォルトは ">= 0" です。
[SEE_ALSO] Gem::Specification#add_development_dependency, Gem::Dependency
- [PARAM]
add_development_dependency(gem, *requirements) -> [Gem::Dependency]Ruby 1.9.3 から[permalink][rdoc][edit]-
この gem の DEVELOPMENT 依存性を追加します。この gem の開発時に必要となる gem を指定します。
gem "rack", "~> 1.6", ">= 1.6.12"- [PARAM]
gem: - 依存する gem の名前か Gem::Dependency のインスタンスを指定します。
- [PARAM]
requirements: - バージョンの必要条件を 0 個以上指定します。デフォルトは ">= 0" です。
[SEE_ALSO] Gem::Specification#add_runtime_dependency, Gem::Dependency
- [PARAM]
author -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
作成者の名前を返します。
author=(name)Ruby 1.9.3 から[permalink][rdoc][edit]-
作成者の名前をセットします。
authors -> ArrayRuby 1.9.3 から[permalink][rdoc][edit]-
作成者の名前の配列を返します。
authors=(names)Ruby 1.9.3 から[permalink][rdoc][edit]-
作成者の名前の配列をセットします。
autorequire -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
非推奨の属性です。
autorequire=(lib)Ruby 1.9.3 から[permalink][rdoc][edit]-
非推奨の属性です。
base_dir -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
gem をインストールするベースディレクトリのフルパスを返します。
例えば
/usr/local/lib/ruby/gems/3.4のようなパスです。 Gem::Specification#loaded_from が設定されていない場合は Gem?.dir を返します。[SEE_ALSO] Gem::Specification#loaded_from, Gem?.dir
bin_dir -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
インストールされた gem の実行ファイル格納ディレクトリへのフルパスを返します。
Gem::Specification#bindir とは異なり、こちらはフルパスを返します。
[SEE_ALSO] Gem::Specification#bindir
bin_file(name) -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この gem に含まれる実行可能ファイル
nameへのフルパスを返します。- [PARAM]
name: - 実行可能ファイル名を指定します。
[SEE_ALSO] Gem::Specification#bin_dir
- [PARAM]
bindir -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
実行ファイルを格納するディレクトリを返します。
bindir=(dir)Ruby 1.9.3 から[permalink][rdoc][edit]-
実行ファイルを格納するディレクトリをセットします。
- [PARAM]
dir: - 実行ファイルを格納するディレクトリを指定します。デフォルトは "bin" です。
- [PARAM]
build_args -> [String]Ruby 2.0.0 から[permalink][rdoc][edit]-
この gem をインストールした際に使われたビルド引数を返します。
ビルド情報を保存したファイルが存在しない場合は空の配列を返します。
例spec = Gem::Specification.new { |s| s.name = "rfoo"; s.version = "1.0" } p spec.build_args # => [] cache_dir -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この spec のキャッシュされた gem ファイルを格納するディレクトリへのフルパスを返します。
[SEE_ALSO] Gem::Specification#cache_file
cache_file -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この spec のキャッシュされた gem ファイルへのフルパスを返します。
[SEE_ALSO] Gem::Specification#cache_dir
cert_chain -> ArrayRuby 1.9.3 から[permalink][rdoc][edit]-
[TODO]
cert_chain=(arr)Ruby 1.9.3 から[permalink][rdoc][edit]-
[TODO]
- [PARAM]
arr: - デフォルトは空の配列です。
- [PARAM]
conflicts -> {Gem::Specification => [object]}Ruby 1.9.3 から[permalink][rdoc][edit]-
現在ロードされている仕様書との間で発生しうる依存関係の競合を返します。
キーが競合する Gem::Specification、値がその競合の原因となった依存関係 (Gem::Dependency や Gem::Requirement)の配列であるハッシュを返します。競合が無い場合は空のハッシュを返します。
例spec = Gem::Specification.new { |s| s.name = "rfoo"; s.version = "1.0" } p spec.conflicts # => {}[SEE_ALSO] Gem::Specification#has_conflicts?
date -> TimeRuby 1.9.3 から[permalink][rdoc][edit]-
日付を返します。
date=(date)Ruby 1.9.3 から[permalink][rdoc][edit]-
- [PARAM]
date: - 日付をセットします。デフォルトは今日です。
- [PARAM]
dependencies -> ArrayRuby 1.9.3 から[permalink][rdoc][edit]-
依存している Gem のリストを返します。
[SEE_ALSO] Gem::Dependency
dependent_gems -> ArrayRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem に依存している全ての Gem の情報のリストを返します。
それぞれのエントリは配列になっており、各要素は以下のようになっています。
dependent_specs -> [Gem::Specification]Ruby 1.9.3 から[permalink][rdoc][edit]-
例selfの RUNTIME 依存性を満たす仕様書をまとめて返します。spec = Gem::Specification.new { |s| s.name = "rfoo"; s.version = "1.0" } p spec.dependent_specs # => [][SEE_ALSO] Gem::Specification#dependencies, Gem::Specification#runtime_dependencies
description -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
Gem パッケージの説明を返します。
description=(desc)Ruby 1.9.3 から[permalink][rdoc][edit]-
Gem パッケージの説明をセットします。
- [PARAM]
desc: - パッケージの詳細を説明する文章を指定します。
- [PARAM]
development_dependencies -> ArrayRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem が依存している Gem のリストを返します。
doc_dir(type = nil) -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この spec のドキュメント格納ディレクトリへのフルパスを返します。
typeを指定した場合は、そのディレクトリの下のtypeという名前のディレクトリ (例えば"ri")へのパスを返します。- [PARAM]
type: - ドキュメントの種類を表す文字列を指定します。省略した場合はドキュメント格納ディレクトリ自体のパスを返します。
[SEE_ALSO] Gem::Specification#ri_dir
- [PARAM]
email -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
メールアドレスを返します。
email=(email)Ruby 1.9.3 から[permalink][rdoc][edit]-
メールアドレスをセットします。
- [PARAM]
email: - メールアドレスを指定します。
- [PARAM]
executable -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
実行可能ファイル名を返します。
executable=(executable)Ruby 1.9.3 から[permalink][rdoc][edit]-
実行可能ファイル名をセットします。
- [PARAM]
executable: - 実行可能ファイル名を指定します。
- [PARAM]
executables -> [String]Ruby 1.9.3 から[permalink][rdoc][edit]-
実行可能ファイル名のリストを返します。
executables=(executables)Ruby 1.9.3 から[permalink][rdoc][edit]-
実行可能ファイル名のリストをセットします。
- [PARAM]
executables: - 実行可能ファイル名のリストを指定します。
- [PARAM]
extension_dir -> StringRuby 2.1.0 から[permalink][rdoc][edit]-
この gem 専用の拡張ライブラリのインストール先ディレクトリへのフルパスを返します。
Gem::Specification#extensions_dir の下に作られる、 Gem::Specification#full_name という名前のディレクトリです。
[SEE_ALSO] Gem::Specification#extensions_dir
extensions -> [String]Ruby 1.9.3 から[permalink][rdoc][edit]-
拡張ライブラリをコンパイルするために必要な extconf.rb 形式のファイルのリストを返します。
extensions=(paths)Ruby 1.9.3 から[permalink][rdoc][edit]-
拡張ライブラリをコンパイルするために必要な extconf.rb 形式のファイルのリストをセットします。
- [PARAM]
paths: - 拡張ライブラリをコンパイルするために必要な extconf.rb 形式のファイルのリストを指定します。
- [PARAM]
extensions_dir -> StringRuby 2.1.0 から[permalink][rdoc][edit]-
拡張ライブラリのインストール先として使われるディレクトリ(プラットフォームごとに共有される)へのフルパスを返します。
[SEE_ALSO] Gem::Specification#extension_dir
extra_rdoc_files -> [String]Ruby 1.9.3 から[permalink][rdoc][edit]-
RDoc でドキュメントを作成する際に使用する特別なファイルのリストを返します。
extra_rdoc_files=(paths)Ruby 1.9.3 から[permalink][rdoc][edit]-
RDoc でドキュメントを作成する際に使用する特別なファイルのリストをセットします。
- [PARAM]
paths: - RDoc でドキュメントを作成する際に使用する特別なファイルのリストを指定します。
- [PARAM]
file_name -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
生成される Gem パッケージの名前を返します。
files -> [String]Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージに含まれるファイル名の配列を返します。
files=(files)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージに含まれるファイル名の配列をセットします。
- [PARAM]
files: - この Gem パッケージに含まれるファイル名の配列を指定します。
- [PARAM]
full_gem_path -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージへのフルパスを返します。
full_name -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージのバージョンを含む完全な名前 (name-version) を返します。
プラットフォームの情報が指定されている場合は、それも含みます (name-version-platform)。
gem_dir -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この spec の gem 本体が格納されているディレクトリへのフルパスを返します。
Gem::Specification#full_gem_path と同じ値を返します。
[SEE_ALSO] Gem::Specification#full_gem_path, Gem::Specification#gems_dir
gems_dir -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この spec の Gem::Specification#gem_dir を含む、gem のインストール先ディレクトリへのフルパスを返します。
[SEE_ALSO] Gem::Specification#gem_dir
has_conflicts? -> boolRuby 2.3.0 から[permalink][rdoc][edit]-
現在ロードされている仕様書との間で発生しうる依存関係の競合があれば true を返します。
例spec = Gem::Specification.new { |s| s.name = "rfoo"; s.version = "1.0" } p spec.has_conflicts? # => false[SEE_ALSO] Gem::Specification#conflicts
has_test_suite? -> boolRuby 1.9.3 から[permalink][rdoc][edit]-
このメソッドは非推奨です。 Gem::Specification#has_unit_tests? を使用してください。
has_unit_tests? -> boolRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージがユニットテストを含むかどうか返します。
真の場合はユニットテストを含みます。そうでない場合は偽を返します。
homepage -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを作成しているプロジェクトか作成者のウェブサイトの URI を返します。
homepage=(uri)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを作成しているプロジェクトか作成者のウェブサイトの URI をセットします。
- [PARAM]
uri: - この Gem パッケージを作成しているプロジェクトか作成者のウェブサイトの URI を指定します。
- [PARAM]
lib_files -> [String]Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージに含まれているファイルのうち Gem::Specification#require_paths 以下にあるファイルのリストを返します。
license -> StringRuby 1.9.2 から[permalink][rdoc][edit]-
Gem::Specification#licenses の最初の要素を返します。
[SEE_ALSO] Gem::Specification#licenses
license=(o)Ruby 1.9.2 から[permalink][rdoc][edit]-
この gem のライセンスをセットします。
SPDX ライセンス識別子を 1 つ指定します。複数のライセンスが適用される gem の場合は Gem::Specification#licenses= を使ってください。
- [PARAM]
o: - ライセンスを表す SPDX ライセンス識別子の文字列を指定します。
spec = Gem::Specification.new { |s| s.name = "rfoo"; s.version = "1.0" } spec.license = "MIT" p spec.license # => "MIT"[SEE_ALSO] Gem::Specification#licenses=
- [PARAM]
licenses -> [String]Ruby 1.9.2 から[permalink][rdoc][edit]-
この gem のライセンスを表す SPDX ライセンス識別子の配列を返します。
[SEE_ALSO] Gem::Specification#license
licenses=(licenses)Ruby 1.9.2 から[permalink][rdoc][edit]-
この gem のライセンスをセットします。
複数のライセンスが適用される gem の場合は、Gem::Specification#license= とは異なりこちらを使って各ライセンスを別々の要素として指定します。
- [PARAM]
licenses: - ライセンスを表す SPDX ライセンス識別子の文字列の配列を指定します。
spec = Gem::Specification.new { |s| s.name = "rfoo"; s.version = "1.0" } spec.licenses = ["MIT", "GPL-2.0-only"] p spec.licenses # => ["MIT", "GPL-2.0-only"] p spec.license # => "MIT"[SEE_ALSO] Gem::Specification#license=
- [PARAM]
loaded_from -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージの gemspec がある場所を返します。
この属性は永続化されません。
loaded_from=(path)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージの gemspec がある場所をセットします。
- [PARAM]
path: - この Gem パッケージの gemspec がある場所を指定します。
- [PARAM]
metadata -> {String => String}Ruby 2.0.0 から[permalink][rdoc][edit]-
この gem のメタデータを返します。
[SEE_ALSO] Gem::Specification#metadata=
metadata=(metadata)Ruby 2.0.0 から[permalink][rdoc][edit]-
この gem のメタデータをセットします。
メタデータは gem の作者以外の利用者にも有用な追加情報です。キーと値がともに文字列である Hash を指定します。キーは最大 128 バイト、値は最大 1024 バイトまでで、全て UTF-8 文字列でなければなりません。ホームページやリポジトリ、changelog、issue tracker などの URI を指定するのに使えます。
- [PARAM]
metadata: - キーと値がいずれも文字列の Hash を指定します。
spec = Gem::Specification.new { |s| s.name = "rfoo"; s.version = "1.0" } spec.metadata = { "source_code_uri" => "https://example.com/rfoo" } p spec.metadata["source_code_uri"] # => "https://example.com/rfoo"[SEE_ALSO] Gem::Specification#metadata
- [PARAM]
missing_extensions? -> boolRuby 2.2.0 から[permalink][rdoc][edit]-
この spec に拡張ライブラリのビルドが必要なものが含まれていて、かつまだビルドされていない場合に true を返します。
例spec = Gem::Specification.new { |s| s.name = "rfoo"; s.version = "1.0" } p spec.missing_extensions? # => false name -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージの名前を返します。
name=(name)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージの名前をセットします。
- [PARAM]
name: - この Gem パッケージの名前を指定します。
- [PARAM]
name_tuple -> Gem::NameTupleRuby 2.0.0 から[permalink][rdoc][edit]-
例selfを表すGem::NameTupleを返します。spec = Gem::Specification.new { |s| s.name = "rfoo"; s.version = "1.0" } p spec.name_tuple # => #<Gem::NameTuple rfoo, 1.0, ruby> p spec.name_tuple.class # => Gem::NameTuple[SEE_ALSO] Gem::Specification#full_name
normalize -> [String]Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージの含まれるファイルリストから重複を取り除きます。
original_name -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
このメソッドは後方互換性のために残されています。
[SEE_ALSO] Gem::Specification#full_name
original_platform -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この属性は古いバージョンの Gem パッケージをアンインストールするために残されています。
original_platform=(platform)Ruby 1.9.3 から[permalink][rdoc][edit]-
この属性は古いバージョンの Gem パッケージをアンインストールするために残されています。
- [PARAM]
platform: - プラットフォームを指定します。
- [PARAM]
platform -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを使用できるプラットフォームを返します。
platform=(platform)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを使用できるプラットフォームをセットします。
- [PARAM]
platform: - この Gem パッケージを使用できるプラットフォームを指定します。デフォルトは Gem::Platform::RUBY です。
[SEE_ALSO] Gem::Platform::RUBY
- [PARAM]
post_install_message -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
インストール完了後に表示するメッセージを返します。
post_install_message=(message)Ruby 1.9.3 から[permalink][rdoc][edit]-
インストール完了後に表示するメッセージをセットします。
- [PARAM]
message: - メッセージを指定します。
- [PARAM]
rdoc_options -> [String]Ruby 1.9.3 から[permalink][rdoc][edit]-
API ドキュメントを生成するときに rdoc コマンドに与えるオプションを返します。
rdoc_options=(options)Ruby 1.9.3 から[permalink][rdoc][edit]-
API ドキュメントを生成するときに rdoc コマンドに与えるオプションをセットします。
- [PARAM]
options: - API ドキュメントを生成するときに rdoc コマンドに与えるオプションを指定します。
- [PARAM]
require_path -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
Gem::Specification#require_paths の単数バージョンです。
[SEE_ALSO] Gem::Specification#require_paths
require_path=(path)Ruby 1.9.3 から[permalink][rdoc][edit]-
Gem::Specification#require_paths= の単数バージョンです。
- [PARAM]
path: - この Gem パッケージを使用した際に require するファイルが置かれているディレクトリを指定します。
[SEE_ALSO] Gem::Specification#require_paths=
- [PARAM]
require_paths -> [String]Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを使用した際に require するファイルが置かれているディレクトリのリストを返します。
require_paths=(paths)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを使用した際に require するファイルが置かれているディレクトリのリストをセットします。
- [PARAM]
paths: - この Gem パッケージを使用した際に require するファイルが置かれているディレクトリのリストを指定します。
- [PARAM]
required_ruby_version -> Gem::RequirementRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを動作させるのに必要な Ruby のバージョンを返します。
required_ruby_version=(requirement)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを動作させるのに必要な Ruby のバージョンをセットします。
- [PARAM]
requirement: - Gem::Requirement.create が受け付ける形式のオブジェクトを指定します。
[SEE_ALSO] Gem::Requirement
- [PARAM]
required_rubygems_version -> Gem::RequirementRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを動作させるのに必要な RubyGems のバージョンを返します。
required_rubygems_version=(requirement)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを動作させるのに必要な RubyGems のバージョンをセットします。
- [PARAM]
requirement: - Gem::Requirement.create が受け付ける形式のオブジェクトを指定します。
[SEE_ALSO] Gem::Requirement
- [PARAM]
requirements -> ArrayRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを動作させるのに必要な条件を返します。これはユーザのためのシンプルな情報です。
requirements=(informations)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを動作させるのに必要な条件をセットします。これはユーザのためのシンプルな情報をセットします。
- [PARAM]
informations: - 情報を文字列の配列で指定します。
- [PARAM]
ri_dir -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この spec の ri 形式のドキュメントを格納するディレクトリへのフルパスを返します。
[SEE_ALSO] Gem::Specification#doc_dir
rubygems_version -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを作成した RubyGems のバージョンを返します。
rubygems_version=(version)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージを作成した RubyGems のバージョンをセットします。この属性は Gem パッケージが作成された時に自動的にセットされます。
- [PARAM]
version: - RubyGems のバージョンを指定します。
- [PARAM]
runtime_dependencies -> ArrayRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージが依存している Gem パッケージのリストを返します。
satisfies_requirement?(dependency) -> boolRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージが与えられた依存関係を満たすかどうかを返します。
依存関係を満たす場合は真を返します。そうでない場合は偽を返します。
- [PARAM]
dependency: - チェックしたい依存関係を指定します。
[SEE_ALSO] Gem::Dependency
- [PARAM]
signing_key -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージの署名に使用するキーを返します。
signing_key=(key)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージの署名に使用するキーをセットします。
- [PARAM]
key: - 署名に使用するキーを指定します。
- [PARAM]
spec_dir -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この spec の gemspec ファイルが置かれているディレクトリへのフルパスを返します。
[SEE_ALSO] Gem::Specification#spec_file
spec_file -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この spec の gemspec ファイルへのフルパスを返します。
例えば
/usr/local/lib/ruby/gems/3.4/specifications/rfoo-1.0.gemspecのようなパスです。[SEE_ALSO] Gem::Specification#spec_dir, Gem::Specification#spec_name
spec_name -> StringRuby 1.9.2 から[permalink][rdoc][edit]-
gemspec ファイルのデフォルトの名前を返します。
Gem::Specification#file_name も参照してください。
例spec = Gem::Specification.new { |s| s.name = "rfoo"; s.version = "1.0" } p spec.spec_name # => "rfoo-1.0.gemspec"[SEE_ALSO] Gem::Specification#file_name, Gem::Specification#spec_file
specification_version -> IntegerRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージに用いられている gemspec のバージョンを返します。
specification_version=(version)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージに用いられている gemspec のバージョンをセットします。
- [PARAM]
version: - gemspec のバージョンを指定します。
[SEE_ALSO] Gem::Specification::SPECIFICATION_VERSION_HISTORY
- [PARAM]
stubbed? -> boolRuby 2.1.0 から[permalink][rdoc][edit]-
常に false を返します。
selfは既に完全にロードされた仕様書であり、スタブ(gemspec ファイルの内容を遅延読み込みする軽量なオブジェクト)ではないためです。[SEE_ALSO] Gem::Specification.stubs
summary -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージの短い説明を返します。
summary=(summary)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージの短い説明をセットします。
- [PARAM]
summary: - 短い説明を指定します。
- [PARAM]
test_file -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
Gem::Specification#test_files の単数バージョンです。
test_file=(file)Ruby 1.9.3 から[permalink][rdoc][edit]-
Gem::Specification#test_files= の単数バージョンです。
test_files -> [String]Ruby 1.9.3 から[permalink][rdoc][edit]-
ユニットテストのファイルのリストを返します。
test_files=(files)Ruby 1.9.3 から[permalink][rdoc][edit]-
ユニットテストのファイルのリストをセットします。
- [PARAM]
files: - ユニットテストのファイルのリストを指定します。
- [PARAM]
to_ruby -> StringRuby 1.9.3 から[permalink][rdoc][edit]-
自身を再現するための Ruby スクリプトを文字列で返します。
省略されている値はデフォルト値が使用されます。
to_spec -> selfRuby 2.1.0 から[permalink][rdoc][edit]-
selfを返します。[SEE_ALSO] Gem::Specification#to_ruby
validate -> boolRuby 1.9.3 から[permalink][rdoc][edit]-
必須属性のチェックと自身の基本的な正当性チェックを行います。
チェックにパスした場合は常に true を返します。そうでない場合は例外が発生します。
- [EXCEPTION]
Gem::InvalidSpecificationException: - チェックにパスしなかった場合に発生します。
- [EXCEPTION]
version -> Gem::VersionRuby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージのバージョンを返します。
version=(version)Ruby 1.9.3 から[permalink][rdoc][edit]-
この Gem パッケージのバージョンをセットします。
- [PARAM]
version: - バージョンを文字列か Gem::Version のインスタンスで指定します。
- [PARAM]
yaml_initializeRuby 1.9.3 から[permalink][rdoc][edit]-
[TODO]
定数
CURRENT_SPECIFICATION_VERSION -> 2Ruby 1.9.3 から[permalink][rdoc][edit]-
現在の gemspec のバージョンを表す定数です。
MARSHAL_FIELDS -> HashRuby 1.9.3 から[permalink][rdoc][edit]-
[TODO]
NONEXISTENT_SPECIFICATION_VERSION -> -1Ruby 1.9.3 から[permalink][rdoc][edit]-
明確に指定されていない時の gemspec のバージョンを表します。
SPECIFICATION_VERSION_HISTORY -> HashRuby 1.9.3 から[permalink][rdoc][edit]-
gemspec ファイルのバージョンの歴史を表す定数です。
TODAY -> TimeRuby 1.9.3 から[permalink][rdoc][edit]-
本日の日付を返します。