Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class OsVersion
- attr_reader :ruby_platform, :os, :ident, :version, :build
- def initialize
- @ruby_platform = RUBY_PLATFORM
- if File.exists?("/proc/version")
- @os = :linux
- @ident = File.open("/proc/version").readlines.join
- elsif `sw_vers`.length != 0
- @os = :macosx
- @version = `sw_vers -productVersion`.chop!
- @build = `sw_vers -buildVersion`
- elsif @ruby_platform =~ /(win|w)32$/
- @os = :windows
- end
- end
- end
Add Comment
Please, Sign In to add comment