Class: Kuby::Dependable
- Inherits:
-
Object
- Object
- Kuby::Dependable
- Defined in:
- lib/kuby/dependable.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#version_or_callable ⇒ Object
readonly
Returns the value of attribute version_or_callable.
Instance Method Summary collapse
-
#initialize(name, version_or_callable) ⇒ Dependable
constructor
A new instance of Dependable.
- #version ⇒ Object
Constructor Details
#initialize(name, version_or_callable) ⇒ Dependable
Returns a new instance of Dependable.
5 6 7 8 |
# File 'lib/kuby/dependable.rb', line 5 def initialize(name, version_or_callable) @name = name @version_or_callable = version_or_callable end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/kuby/dependable.rb', line 3 def name @name end |
#version_or_callable ⇒ Object (readonly)
Returns the value of attribute version_or_callable.
3 4 5 |
# File 'lib/kuby/dependable.rb', line 3 def version_or_callable @version_or_callable end |
Instance Method Details
#version ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/kuby/dependable.rb', line 10 def version @version ||= Kuby::Utils::SemVer.parse_version( if version_or_callable.respond_to?(:call) version_or_callable.call else version_or_callable end ) end |