uuidtools 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. data/CHANGELOG +3 -1
  2. data/README +4 -1
  3. data/lib/uuidtools.rb +71 -29
  4. data/rakefile +1 -1
  5. metadata +2 -2
data/CHANGELOG CHANGED
@@ -1,2 +1,4 @@
1
- == UUIDTools 0.0.1
1
+ == UUIDTools 0.1.1
2
+ * changed helper methods to be protected like they should have been
3
+ == UUIDTools 0.1.0
2
4
  * parsing and generation of UUIDs implemented
data/README CHANGED
@@ -1,5 +1,6 @@
1
1
  UUIDTools was designed to be a simple library for generating any
2
- of the various types of UUIDs.
2
+ of the various types of UUIDs. It conforms to RFC 4122 whenever
3
+ possible.
3
4
 
4
5
  == Example
5
6
  UUID.md5_create(UUID_DNS_NAMESPACE, "www.widgets.com")
@@ -8,3 +9,5 @@
8
9
  => #<UUID:0x2a0116 UUID:21f7f8de-8051-5b89-8680-0195ef798b6a>
9
10
  UUID.timestamp_create
10
11
  => #<UUID:0x2adfdc UUID:64a5189c-25b3-11da-a97b-00c04fd430c8>
12
+ UUID.random_create
13
+ => #<UUID:0x19013a UUID:984265dc-4200-4f02-ae70-fe4f48964159>
@@ -21,7 +21,7 @@
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  #++
23
23
 
24
- UUID_TOOLS_VERSION = "0.1.0"
24
+ UUID_TOOLS_VERSION = "0.1.1"
25
25
 
26
26
  $:.unshift(File.dirname(__FILE__))
27
27
 
@@ -34,34 +34,64 @@ require 'digest/md5'
34
34
  # Because it's impossible to hype a UUID generator on its genuine merits,
35
35
  # I give you... Really bad ASCII art in the comments:
36
36
  #
37
- # ..´´´ .'´``´´.´´´´´´´´´`´´´´´´ ´. ´`` ..
38
- # SaSS99SSUaSSUaUkdaUa0SSUSkUUSXSF2T0BHEKEHHKEEH59,:::::::::::;L":?C1;:::::?
39
- # EKQBHEBWBQBWHKKHHHEWgEBKgqQKEBEdcMMMMMMMMMMMMNBU.«l:,..,..:1C,----,?"??»(r
40
- # EWHKKEBBHKBWEEWQKWKHBWHHWWHq9aLD"MMMMMMMMMMMMH0r7tPTOtlti6v--......-.:9QQS
41
- # BEKKWWKKHKKHBEBWEEqKEHKR6uvTAUhGlMMMMMMMMMMMe?,.,!,rE».-v8q"`--,.,-,.teNMH
42
- # EEBBgBBKKHEWBgKHKKREB8ZrPahUahalOMMMMMMMMMMA;?:!!-,,"DTkBMMP"..,-.,-,hEMMK
43
- # EKWHRHHWEBEBEBgKHR3tY000Ya0a00h:eMMMMMMMMMqu-.l;».--.hqMMMMNP'.,-.,,ASMMME
44
- # HqBNRNNkWKBEHBAv?"TahA0FvUhUUhG"eMMMMMMMMM4)««::;--,.Z5MMMMM8O:---?0XMMMMH
45
- # K9NWHHaHRSoorrl0aU0ahU0nh0hhA01lHMMMMMMMMND',,-..--.,44MMMMMMBR5L8RHMMMMMB
46
- # WEBqE86tuu00hLCUUUAA0U0a0AAUdb?LMMMMMMMMMMe´-,,.--,.;DHMMMMMMMMMMMMMMMMMME
47
- # F54Dh0kSaADUAtSDhhh0h00AAU0ThalDMMMMMMMMMMR7,-..--,«0HMMMMMMMMMMMMMMMMMMME
48
- # GDa00hbaUhAh0L9ahahaaUUU0hYhX»CNMMMMMMMMMMHOo;.,..!uuaNMMMMMMMMMMMMMMMMMMB
49
- # OA0Ah9haUAUADAhaUAhD9Uaah0UUZ?5MMMMMMMMMM8O-,.--,-,,,tAEMMMMMMMMMMMMMMMMMB
50
- # 0UhhhXhUP0F0USUAASvFkh0AaAhq;1HMMMMMMMMMAL.--,..---,--?FHMMMMMMMMMMMMMMMME
51
- # AAA4bShUuaahhA0ahTOa00AFrUaQ"ULkWWBMMNMge":-,.;,,l.--,,P4MMMMMMMMMMMMMMMMB
52
- # 0UuZkUAh0hhaAaa0dehA0U0YDAS4JhjdLQRLehXP-??"».j,1l--,-,-9HMMMMMMMMMMMMMMMH
53
- # AhZASaSSUU0aAa0UAAUUhAahUhb;uWEge5L4gaHG9R67t"tc7?;;;l":aPMMMMMMMMMMMMMMMH
54
- # Ua0akXqUaU9aaUa00hAS0aAaUkutHMMMMMNKELBZCBHSMMMNBa2";,"rAFMMMMMMMMMMMMMMMB
55
- # AhdtSqSUAhXFh0UhAD1oP00hAq"hMMMMMMMMMOZ:-""PTkgWENMMMNEKHXKgHMMMMMMMMMMMMH
56
- # aaT6UU0UAUuDaaAaa?G8S0aaqLuMMMMMMMMMM6L,,--!-..,-,:?1LhWNNMMHEEQgHMMMMMMMH
57
- # L6JuuuLuLu1uLuuLIJuTLLuuJ"UqR8RqXqq8q2u-:::-:::::---:-::Tju6Rq8qqeuUqRRqqA
58
- # ´. . ´´.´.` ´.´...´..´.'´. ´'.´ `.´`´´´ ´.´´'.´ ´´´ `´.´ ´`'´´.´' '.´.´´´
59
- # ´ ´
37
+ #
38
+ # \
39
+ # /
40
+ # +
41
+ # ]
42
+ # ]
43
+ # |
44
+ # /
45
+ # Mp___
46
+ # `~0NNp,
47
+ # __ggM'
48
+ # g0M~"`
49
+ # ]0M*-
50
+ #
51
+ # ___
52
+ # _g000M00g,
53
+ # j0M~ ~M&
54
+ # j0M" ~N,
55
+ # j0P M&
56
+ # jM 1
57
+ # j0 ]1
58
+ # .0P 0,
59
+ # 00' M&
60
+ # 0M ]0L
61
+ # ]0f ___ M0
62
+ # M0NN0M00MMM~"'M 0&
63
+ # `~ ~0 ]0,
64
+ # ]M ]0&
65
+ # M& M0,
66
+ # ____gp_ M& M0_
67
+ # __p0MPM8MM&_ M/ ^0&_
68
+ # gN"` M0N_j0, MM&__
69
+ # _gF `~M0P` __ M00g
70
+ # g0' gM0&, ~M0&
71
+ # _pM` 0, ]M1 "00&
72
+ # _00 /g1MMgj01 ]0MI
73
+ # _0F t"M,7MMM 00I
74
+ # g0' _ N&j& 40'
75
+ # g0' _p0Mq_ ' N0QQNM#g,
76
+ # 0' _g0000000g__ ~M@MMM000g
77
+ # f _jM00@` ~M0000Mgppg, "P00&
78
+ # | g000~ `~M000000&_ ~0&
79
+ # ]M _M00F "00MM` ~#&
80
+ # `0L m000F #E "0f
81
+ # 9r j000M` 40, 00
82
+ # ]0g_ j00M` ^M0MNggp#gqpg M0&
83
+ # ~MPM0f ~M000000000g_ ,_ygg&M00f
84
+ # `~~~M00000000000000
85
+ # `M0000000000f
86
+ # ~@@@MF~`
87
+ #
88
+ #
60
89
 
61
90
  #= uuidtools.rb
62
91
  #
63
92
  # UUIDTools was designed to be a simple library for generating any
64
- # of the various types of UUIDs.
93
+ # of the various types of UUIDs. It conforms to RFC 4122 whenever
94
+ # possible.
65
95
  #
66
96
  #== Example
67
97
  # UUID.md5_create(UUID_DNS_NAMESPACE, "www.widgets.com")
@@ -70,6 +100,8 @@ require 'digest/md5'
70
100
  # => #<UUID:0x2a0116 UUID:21f7f8de-8051-5b89-8680-0195ef798b6a>
71
101
  # UUID.timestamp_create
72
102
  # => #<UUID:0x2adfdc UUID:64a5189c-25b3-11da-a97b-00c04fd430c8>
103
+ # UUID.random_create
104
+ # => #<UUID:0x19013a UUID:984265dc-4200-4f02-ae70-fe4f48964159>
73
105
  class UUID
74
106
  @@last_timestamp = nil
75
107
  @@last_node_id = nil
@@ -279,10 +311,10 @@ class UUID
279
311
 
280
312
  # Returns the UUID variant.
281
313
  # Possible values:
282
- # 0x000 - Reserved, NCS backward compatibility.
283
- # 0x100 - The variant specified in this document.
284
- # 0x110 - Reserved, Microsoft Corporation backward compatibility.
285
- # 0x111 - Reserved for future definition.
314
+ # 0b000 - Reserved, NCS backward compatibility.
315
+ # 0b100 - The variant specified in this document.
316
+ # 0b110 - Reserved, Microsoft Corporation backward compatibility.
317
+ # 0b111 - Reserved for future definition.
286
318
  def variant
287
319
  variant_raw = (clock_seq_hi_and_reserved >> 5)
288
320
  result = nil
@@ -453,6 +485,8 @@ class UUID
453
485
  end
454
486
 
455
487
  # Returns 128 bits of highly unpredictable data.
488
+ # The random number generator isn't perfect, but it's
489
+ # much, much better than the built-in pseudorandom number generators.
456
490
  def UUID.true_random
457
491
  require 'benchmark'
458
492
  hash = Digest::SHA1.new
@@ -505,6 +539,14 @@ class UUID
505
539
  end
506
540
  return integer
507
541
  end
542
+
543
+ class << self
544
+ protected :create_from_hash
545
+ protected :get_mac_address
546
+ protected :true_random
547
+ protected :convert_int_to_byte_string
548
+ protected :convert_byte_string_to_int
549
+ end
508
550
  end
509
551
 
510
552
  UUID_DNS_NAMESPACE = UUID.parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8")
data/rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/gempackagetask'
7
7
  require 'rake/contrib/rubyforgepublisher'
8
8
 
9
9
  PKG_NAME = 'uuidtools'
10
- PKG_VERSION = '0.1.0'
10
+ PKG_VERSION = '0.1.1'
11
11
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
12
12
 
13
13
  RELEASE_NAME = "REL #{PKG_VERSION}"
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: uuidtools
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2005-09-15 00:00:00 -04:00
6
+ version: 0.1.1
7
+ date: 2005-09-16 00:00:00 -04:00
8
8
  summary: Generation of UUIDs.
9
9
  require_paths:
10
10
  - lib