Class: RailsFinder::EnvironmentFile
- Inherits:
-
Object
- Object
- RailsFinder::EnvironmentFile
- Defined in:
- lib/rails_finder/environment_file.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #exists? ⇒ Boolean
-
#initialize(path) ⇒ EnvironmentFile
constructor
A new instance of EnvironmentFile.
- #rails_version ⇒ Object
Constructor Details
#initialize(path) ⇒ EnvironmentFile
Returns a new instance of EnvironmentFile.
5 6 7 |
# File 'lib/rails_finder/environment_file.rb', line 5 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/rails_finder/environment_file.rb', line 3 def path @path end |
Instance Method Details
#exists? ⇒ Boolean
9 10 11 |
# File 'lib/rails_finder/environment_file.rb', line 9 def exists? File.exists?(path) end |
#rails_version ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rails_finder/environment_file.rb', line 13 def rails_version return @rails_version if @rails_version version_line = File.readlines(path).find { |l| l =~ /RAILS_GEM_VERSION/ } if version_line @rails_version = version_line[/\d+\.\d+(\.\d+)?/].strip else @rails_version = "n/a" end end |