Skip to content

Commit

Permalink
Changed interface names
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgan Hallgren committed Jul 9, 2013
1 parent a1b565f commit 0c4d44d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/uuid_shortner/guid_decoder.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module UuidShortner
module GuidDecoder
def decode short_uuid
def stretch short_uuid
guid_as_int = bijective_decode short_uuid
guid_as_hex = guid_as_int.to_s(16)
insert_uuid_hyphens guid_as_hex
Expand Down
2 changes: 1 addition & 1 deletion lib/uuid_shortner/guid_encoder.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module UuidShortner
module GuidEncoder
def encode uuid
def compress uuid
clean_guid = uuid.gsub(/[^a-zA-Z0-9 ]/,'')
guid_as_hex = clean_guid.hex
short_id = bijective_encode guid_as_hex
Expand Down
10 changes: 5 additions & 5 deletions spec/decode_encode_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ module UuidShortner
u = UUID.new
10.times do
id = u.generate
short_id = @dummy_object.encode id
short_id = @dummy_object.compress id
short_id.length.should <= 22
decoded = @dummy_object.decode short_id
decoded.should eql id
uuid = @dummy_object.stretch short_id
uuid.should eql id
end
end
it "should decode and encode edge cases" do
c1 = "00000310-250a-0130-47db-58b035f3cd77"
e1 = @dummy_object.encode c1
@dummy_object.decode(e1).should eql c1
e1 = @dummy_object.compress c1
@dummy_object.stretch(e1).should eql c1
end
end
end

0 comments on commit 0c4d44d

Please sign in to comment.