Class: PostIt::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/postit/parser.rb

Constant Summary collapse

BUNDLED_WITH =
/\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Parser

Returns a new instance of Parser.



3
4
5
# File 'lib/postit/parser.rb', line 3

def initialize(file)
  @file = file
end

Instance Method Details

#parseObject



10
11
12
13
14
15
16
17
18
# File 'lib/postit/parser.rb', line 10

def parse
  lockfile = File.read(@file) if File.file?(@file)
  return unless lockfile
  if lockfile =~ BUNDLED_WITH
    Regexp.last_match(1)
  else
    '< 1.10'
  end
end