Class: Bumpversion::Reader
- Inherits:
-
Object
- Object
- Bumpversion::Reader
- Defined in:
- lib/bumpversion/reader.rb
Instance Attribute Summary collapse
-
#files_to_write ⇒ Object
readonly
Returns the value of attribute files_to_write.
Instance Method Summary collapse
-
#initialize(options) ⇒ Reader
constructor
A new instance of Reader.
- #reader! ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(options) ⇒ Reader
Returns a new instance of Reader.
3 4 5 6 |
# File 'lib/bumpversion/reader.rb', line 3 def initialize() @options = @files_to_write = [] end |
Instance Attribute Details
#files_to_write ⇒ Object (readonly)
Returns the value of attribute files_to_write.
8 9 10 |
# File 'lib/bumpversion/reader.rb', line 8 def files_to_write @files_to_write end |
Instance Method Details
#reader! ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/bumpversion/reader.rb', line 16 def reader! files_to_read = @options[:file].split(",") files_to_read.each do |file_to_read| files_to_write << { filename: file_to_read, content: File.read(file_to_read) } end validate! end |
#validate! ⇒ Object
10 11 12 13 14 |
# File 'lib/bumpversion/reader.rb', line 10 def validate! files_to_write.each do |file_to_write| raise "Current Version not found in #{file_to_write[:filename]} file" unless file_to_write[:content].include? @options[:current_version] end end |