Class: Bunup::Gem
- Inherits:
-
Object
- Object
- Bunup::Gem
- Defined in:
- lib/bunup/gem.rb
Overview
Easily access gem attributes
Constant Summary collapse
- SPECIAL_CHARACTERS =
Gem name patterns taken from github.com/rubygems/rubygems.org/blob/master/lib/patterns.rb
'.-_'
- ALLOWED_CHARACTERS =
'[A-Za-z0-9' \ "#{Regexp.escape(SPECIAL_CHARACTERS)}]+"
- NAME_PATTERN =
/\A#{ALLOWED_CHARACTERS}\Z/.freeze
Instance Attribute Summary collapse
-
#installed_version ⇒ Object
Returns the value of attribute installed_version.
-
#name ⇒ Object
Returns the value of attribute name.
-
#newest_version ⇒ Object
Returns the value of attribute newest_version.
Instance Method Summary collapse
-
#initialize(name: nil, installed_version: nil, newest_version: nil) ⇒ Gem
constructor
A new instance of Gem.
- #installed_from_git? ⇒ Boolean
Constructor Details
#initialize(name: nil, installed_version: nil, newest_version: nil) ⇒ Gem
Returns a new instance of Gem.
17 18 19 20 21 22 |
# File 'lib/bunup/gem.rb', line 17 def initialize(name: nil, installed_version: nil, newest_version: nil) @name = name @installed_version = Values::Version.new(installed_version) @newest_version = Values::Version.new(newest_version) validate end |
Instance Attribute Details
#installed_version ⇒ Object
Returns the value of attribute installed_version.
15 16 17 |
# File 'lib/bunup/gem.rb', line 15 def installed_version @installed_version end |
#name ⇒ Object
Returns the value of attribute name.
15 16 17 |
# File 'lib/bunup/gem.rb', line 15 def name @name end |
#newest_version ⇒ Object
Returns the value of attribute newest_version.
15 16 17 |
# File 'lib/bunup/gem.rb', line 15 def newest_version @newest_version end |
Instance Method Details
#installed_from_git? ⇒ Boolean
24 25 26 |
# File 'lib/bunup/gem.rb', line 24 def installed_from_git? installed_version.from_git? || newest_version.from_git? end |