Class: Bundler::GemBytes::Actions::Gemspec::Dependency
- Inherits:
-
Struct
- Object
- Struct
- Bundler::GemBytes::Actions::Gemspec::Dependency
- Defined in:
- lib/bundler/gem_bytes/actions/gemspec/dependency.rb
Overview
Holds the components of a dependency declaration
A dependency declaration is a call to ‘add_dependency`, `add_runtime_dependency`, or `add_development_dependency` in the Gem::Specification block.
For example, the following is a dependency declaration:
“‘ruby spec.add_dependency ’rubocop’, ‘~> 1.0’ “‘
Would be represented by a Dependency object with the following attributes:
* method_name: :add_dependency
* gem_name: 'rubocop'
* version_constraint: '~> 1.0'
Instance Attribute Summary collapse
-
#gem_name ⇒ String
readonly
The name of the gem being depended on.
-
#method_name ⇒ Symbol
readonly
The name of the method called to add the dependency.
-
#version_constraints ⇒ Array<String>
readonly
The version constraints for the dependency.
Instance Method Summary collapse
-
#to_a ⇒ Array
Converts the dependency into an array.
Instance Attribute Details
#gem_name ⇒ String (readonly)
The name of the gem being depended on
67 68 69 |
# File 'lib/bundler/gem_bytes/actions/gemspec/dependency.rb', line 67 Dependency = Struct.new(:method_name, :gem_name, :version_constraints) do def to_a = [method_name, gem_name, *version_constraints] end |
#method_name ⇒ Symbol (readonly)
The name of the method called to add the dependency
Must be one of the following:
-
:add_dependency
-
:add_runtime_dependency
-
:add_development_dependency
67 68 69 |
# File 'lib/bundler/gem_bytes/actions/gemspec/dependency.rb', line 67 Dependency = Struct.new(:method_name, :gem_name, :version_constraints) do def to_a = [method_name, gem_name, *version_constraints] end |
#version_constraints ⇒ Array<String> (readonly)
The version constraints for the dependency
67 68 69 |
# File 'lib/bundler/gem_bytes/actions/gemspec/dependency.rb', line 67 Dependency = Struct.new(:method_name, :gem_name, :version_constraints) do def to_a = [method_name, gem_name, *version_constraints] end |
Instance Method Details
#to_a ⇒ Array
Converts the dependency into an array
67 68 69 |
# File 'lib/bundler/gem_bytes/actions/gemspec/dependency.rb', line 67 Dependency = Struct.new(:method_name, :gem_name, :version_constraints) do def to_a = [method_name, gem_name, *version_constraints] end |