Class: InvocaGems::GemspecLine
- Inherits:
-
Object
- Object
- InvocaGems::GemspecLine
- Defined in:
- lib/invoca_gems/gemspec_line.rb
Instance Attribute Summary collapse
-
#gem_name ⇒ Object
readonly
Returns the value of attribute gem_name.
-
#gemspec ⇒ Object
readonly
Returns the value of attribute gemspec.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
Instance Method Summary collapse
-
#initialize(gemspec, gem_name, line, index) ⇒ GemspecLine
constructor
A new instance of GemspecLine.
- #save! ⇒ Object
- #update_version(new_version) ⇒ Object
Constructor Details
#initialize(gemspec, gem_name, line, index) ⇒ GemspecLine
Returns a new instance of GemspecLine.
4 5 6 7 8 9 10 |
# File 'lib/invoca_gems/gemspec_line.rb', line 4 def initialize(gemspec, gem_name, line, index) @gemspec = gemspec @gem_name = gem_name @line = line @index = index @prefix = @line.match(/\A(\s*\S+\s+)[\'\"]/)[1] end |
Instance Attribute Details
#gem_name ⇒ Object (readonly)
Returns the value of attribute gem_name.
2 3 4 |
# File 'lib/invoca_gems/gemspec_line.rb', line 2 def gem_name @gem_name end |
#gemspec ⇒ Object (readonly)
Returns the value of attribute gemspec.
2 3 4 |
# File 'lib/invoca_gems/gemspec_line.rb', line 2 def gemspec @gemspec end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
2 3 4 |
# File 'lib/invoca_gems/gemspec_line.rb', line 2 def index @index end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
2 3 4 |
# File 'lib/invoca_gems/gemspec_line.rb', line 2 def line @line end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
2 3 4 |
# File 'lib/invoca_gems/gemspec_line.rb', line 2 def prefix @prefix end |
Instance Method Details
#save! ⇒ Object
12 13 14 |
# File 'lib/invoca_gems/gemspec_line.rb', line 12 def save! gemspec.save!(self) end |
#update_version(new_version) ⇒ Object
16 17 18 |
# File 'lib/invoca_gems/gemspec_line.rb', line 16 def update_version(new_version) @line = "#{@prefix}'#{gem_name}', '#{new_version}'" end |