Class: Luban::Deployment::Package::Dependency
- Inherits:
-
Object
- Object
- Luban::Deployment::Package::Dependency
- Defined in:
- lib/luban/deployment/cli/package/dependency.rb
Instance Attribute Summary collapse
-
#apply_to ⇒ Object
readonly
Returns the value of attribute apply_to.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #applicable_to?(version) ⇒ Boolean
-
#initialize(apply_to, type, name, version, **opts) ⇒ Dependency
constructor
A new instance of Dependency.
Constructor Details
#initialize(apply_to, type, name, version, **opts) ⇒ Dependency
Returns a new instance of Dependency.
13 14 15 16 17 18 19 20 |
# File 'lib/luban/deployment/cli/package/dependency.rb', line 13 def initialize(apply_to, type, name, version, **opts) @apply_to = apply_to @type = type @name = name @version = version @options = opts validate end |
Instance Attribute Details
#apply_to ⇒ Object (readonly)
Returns the value of attribute apply_to.
7 8 9 |
# File 'lib/luban/deployment/cli/package/dependency.rb', line 7 def apply_to @apply_to end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/luban/deployment/cli/package/dependency.rb', line 9 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/luban/deployment/cli/package/dependency.rb', line 11 def @options end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/luban/deployment/cli/package/dependency.rb', line 8 def type @type end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
10 11 12 |
# File 'lib/luban/deployment/cli/package/dependency.rb', line 10 def version @version end |
Instance Method Details
#applicable_to?(version) ⇒ Boolean
22 23 24 25 26 27 28 |
# File 'lib/luban/deployment/cli/package/dependency.rb', line 22 def applicable_to?(version) if @apply_to == :all true else Gem::Requirement.new(@apply_to).satisfied_by?(Gem::Version.new(version)) end end |