Sha256: 7976522fff88ffa43dde05613be977dd3193e718c25d583da73e6c5ed972f8fd

Contents?: true

Size: 669 Bytes

Versions: 10

Compression:

Stored size: 669 Bytes

Contents

module Appjam

  module Utility
    class XcodeUUIDGenerator

        def initialize
            @num = [Time.now.to_i, Process.pid, getMAC]
        end

        # Get the ethernet hardware address ("MAC"). This version
        # works on Mac OS X 10.6 (Snow Leopard); it has not been tested
        # on other versions.

        def getMAC(interface='en0')
            addrMAC = `ifconfig #{interface} ether`.split("\n")[1]
            addrMAC ? addrMAC.strip.split[1].gsub(':','').to_i(16) : 0
        end

        def generate
            @num[0] += 1
            self
        end

        def to_s
            "%08X%04X%012X" % @num
        end
    end
  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
appjam-0.1.8.11 lib/appjam/utility.rb
appjam-0.1.8.10 lib/appjam/utility.rb
appjam-0.1.8.9 lib/appjam/utility.rb
appjam-0.1.8.8 lib/appjam/utility.rb
appjam-0.1.8.7 lib/appjam/utility.rb
appjam-0.1.8.6 lib/appjam/utility.rb
appjam-0.1.8.5 lib/appjam/utility.rb
appjam-0.1.8.4 lib/appjam/utility.rb
appjam-0.1.8.3 lib/appjam/utility.rb
appjam-0.1.8.2 lib/appjam/utility.rb