-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUnleash.Types.pas
68 lines (50 loc) · 1 KB
/
Unleash.Types.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
unit Unleash.Types;
interface
uses
System.Classes,
System.Generics.Collections;
type
TUnleashStrategy = class
public
Name: string;
Ids: TStrings;
Percentage: Integer;
constructor Create;
destructor Destroy; override;
function IsInIds(const Id: string): Boolean;
end;
TUnleashFeature = class
public
Name: string;
Description: string;
Enabled: Boolean;
Strategies: TList<TUnleashStrategy>;
constructor Create;
destructor Destroy; override;
end;
implementation
{ TUnleashStrategy }
constructor TUnleashStrategy.Create;
begin
Ids := TStringList.Create;
end;
destructor TUnleashStrategy.Destroy;
begin
Ids.Free;
inherited;
end;
function TUnleashStrategy.IsInIds(const Id: string): Boolean;
begin
Result := Ids.IndexOf(Id) <> -1;
end;
{ TUnleashFeature }
constructor TUnleashFeature.Create;
begin
Strategies := TObjectList<TUnleashStrategy>.Create;
end;
destructor TUnleashFeature.Destroy;
begin
Strategies.Free;
inherited;
end;
end.