lib/total.rb in total-0.1.0 vs lib/total.rb in total-0.2.0

- old
+ new

@@ -35,10 +35,13 @@ # # Author:: Yegor Bugayenko (yegor256@gmail.com) # Copyright:: Copyright (c) 2018 Yegor Bugayenko # License:: MIT module Total + # When it's impossible to detect something. + class CantDetect < StandardError; end + # Memory specifics. class Mem # Get it in bytes. def bytes target.memory @@ -48,9 +51,9 @@ # Target object to calculate memory size. def target return Total::OSX.new if RUBY_PLATFORM.include?('darwin') return Total::Linux.new if RUBY_PLATFORM.include?('linux') - raise "Can\'t detect operating system: #{RUBY_PLATFORM}" + raise CantDetect, "Can\'t detect operating system: #{RUBY_PLATFORM}" end end end