Guest User

Untitled

a guest
Feb 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. class OsVersion
  2. attr_reader :ruby_platform, :os, :ident, :version, :build
  3. def initialize
  4. @ruby_platform = RUBY_PLATFORM
  5. if File.exists?("/proc/version")
  6. @os = :linux
  7. @ident = File.open("/proc/version").readlines.join
  8. elsif `sw_vers`.length != 0
  9. @os = :macosx
  10. @version = `sw_vers -productVersion`.chop!
  11. @build = `sw_vers -buildVersion`
  12. elsif @ruby_platform =~ /(win|w)32$/
  13. @os = :windows
  14. end
  15. end
  16. end
Add Comment
Please, Sign In to add comment