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