Class: Pik::VersionParser
Class Method Summary collapse
Instance Method Summary collapse
- #date ⇒ Object
- #full_version ⇒ Object
-
#initialize(version) ⇒ VersionParser
constructor
A new instance of VersionParser.
- #interpreter ⇒ Object
- #patchlevel ⇒ Object
- #platform ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(version) ⇒ VersionParser
Returns a new instance of VersionParser.
9 10 11 12 |
# File 'lib/pik/version_parser.rb', line 9 def initialize(version) @version = version @parts = @version.split(/ |\(|\)/).reject{|i| i.empty? } end |
Class Method Details
.parse(version) ⇒ Object
5 6 7 |
# File 'lib/pik/version_parser.rb', line 5 def self.parse(version) new(version) end |
Instance Method Details
#date ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/pik/version_parser.rb', line 23 def date case interpreter when 'IronRuby' nil when 'ruby', 'jruby' md = @version.match(/\d\d\d\d\-\d\d\-\d\d/) md[0] if md end end |
#full_version ⇒ Object
43 44 45 |
# File 'lib/pik/version_parser.rb', line 43 def full_version @version[5..-1] end |
#interpreter ⇒ Object
14 15 16 |
# File 'lib/pik/version_parser.rb', line 14 def interpreter @interpreter ||= @parts[1] end |
#patchlevel ⇒ Object
38 39 40 41 |
# File 'lib/pik/version_parser.rb', line 38 def patchlevel md = @version.match(/patchlevel (\d+)|\dp(\d+)/) md.to_a.compact.last if md end |
#platform ⇒ Object
33 34 35 36 |
# File 'lib/pik/version_parser.rb', line 33 def platform md = @version.match(/\[(.+)\]|(\.NET.+)/) md.to_a.compact.last if md end |
#version ⇒ Object
18 19 20 21 |
# File 'lib/pik/version_parser.rb', line 18 def version md = @parts[2].match(/\d\.\d\.\d\.\d|\d\.\d\.\d/) md[0] if md end |