@@ -32,11 +32,11 @@ Code0::License.encryption_key = private_key
3232# create a license
3333license = Code0 ::License .new (
3434 {
35- ' licensee' => { ' company' => ' Code0' }, # content of licensee can be as you want, it just can't be empty
36- ' start_date' => ' 2024-05-01' , # when is the first date where this license is valid?
37- ' end_date' => ' 2025-05-01' , # until when is the license valid?
38- ' restrictions' => {}, # content can be as you wish, can be used to semantically store some restrictions that are evaluated by your application
39- ' options' => {}, # content can be as you wish, can be used to semantically provide some options of this license
35+ licensee: { company: ' Code0' }, # content of licensee can be as you want, it just can't be empty
36+ start_date: ' 2024-05-01' , # when is the first date where this license is valid?
37+ end_date: ' 2025-05-01' , # until when is the license valid?
38+ restrictions: {}, # content can be as you wish, can be used to semantically store some restrictions that are evaluated by your application
39+ options: {}, # content can be as you wish, can be used to semantically provide some options of this license
4040 }
4141)
4242
@@ -59,10 +59,10 @@ Code0::License.encryption_key = public_key
5959# load the license
6060license = Code0 ::License .load (File .read(' license.txt' ))
6161
62- # exit if license is valid or outside of the valid time
62+ # exit if license is not valid or outside of the valid time
6363exit unless license.valid?
6464exit unless license.in_active_time?
6565
6666# for example, exit if users exceed licensed amount
67- exit if User .count > license.restrictions[' user_count' ]
67+ exit if license.restricted?( :user_count ) && User .count > license.restrictions[: user_count ]
6868```
0 commit comments