diff options
| author | Stefan Daschek <[email protected]> | 2013-07-08 16:34:28 +0200 |
|---|---|---|
| committer | Stefan Daschek <[email protected]> | 2013-07-08 16:34:28 +0200 |
| commit | 2a4c39f7ae863ac7e4d14e0110aba11fce4a822f (patch) | |
| tree | 5066098e520ba7a5d50d36eb0f39f20a5266fd84 /lib | |
| parent | 92b73ffb1e5cdfb001da684c463856f79aff6e11 (diff) | |
| download | caxlsx-2a4c39f7ae863ac7e4d14e0110aba11fce4a822f.tar.gz caxlsx-2a4c39f7ae863ac7e4d14e0110aba11fce4a822f.zip | |
Simply Relationship.next_free_id by depending on number of cached instances.
Only drawback: Setting @next_freed_id_counter to 1000 in tc_helper.rb is no longer possible. But this was useful mainly while adding / fixing test cases when implementing the Relationship instance cache.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/rels/relationship.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/axlsx/rels/relationship.rb b/lib/axlsx/rels/relationship.rb index 64356d46..5e75a98a 100644 --- a/lib/axlsx/rels/relationship.rb +++ b/lib/axlsx/rels/relationship.rb @@ -14,9 +14,7 @@ module Axlsx # Generate and return a unique id. Used for setting {#Id}. # @return [String] def next_free_id - @next_free_id_counter ||= 0 - @next_free_id_counter += 1 - "rId#{@next_free_id_counter}" + "rId#{@instances.size + 1}" end end |
