Skip to content

Commit add93e1

Browse files
authored
Merge pull request #144 from rainerborene/feature/fixture_set
feat(fixture_set): implement non signed global_id helper method
2 parents b670d36 + 532e4cd commit add93e1

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

lib/global_id/fixture_set.rb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@
22

33
class GlobalID
44
module FixtureSet
5-
def signed_global_id(fixture_set_name, label, column_type: :integer, **options)
6-
identifier = identify(label, column_type)
7-
model_name = default_fixture_model_name(fixture_set_name)
8-
uri = URI::GID.build([GlobalID.app, model_name, identifier, {}])
5+
def global_id(fixture_set_name, label, column_type: :integer, **options)
6+
create_global_id(fixture_set_name, label, column_type: column_type, klass: GlobalID, **options)
7+
end
98

10-
SignedGlobalID.new(uri, **options)
9+
def signed_global_id(fixture_set_name, label, column_type: :integer, **options)
10+
create_global_id(fixture_set_name, label, column_type: column_type, klass: SignedGlobalID, **options)
1111
end
12+
13+
private
14+
def create_global_id(fixture_set_name, label, klass:, column_type: :integer, **options)
15+
identifier = identify(label, column_type)
16+
model_name = default_fixture_model_name(fixture_set_name)
17+
uri = URI::GID.build([GlobalID.app, model_name, identifier, {}])
18+
klass.new(uri, **options)
19+
end
1220
end
1321
end

0 commit comments

Comments
 (0)