dtr_core 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6c9f5d565053f972e929ebf804b406c0d7ffac636696735090e24ff2b6894025
4
- data.tar.gz: 689ce2465bc629ff58dfb90ceac46603f55d0c67f21b98147af65d22861d4bd9
3
+ metadata.gz: cfbb64221cf4951c057d70eebcfb02cfb6c26930db47e47e8b56b2d02619631b
4
+ data.tar.gz: 99df8b3da4826433ceddb12930209c8bc0d55b91db84086a4485d13324a6c60f
5
5
  SHA512:
6
- metadata.gz: 1a7e1c1981489448008d43bf66a91544154b6ed1b406d23f13e8b5b509e1f15bc6ecb3b24ab94b80ecdedef8af36329888353265c0f03a68cab5a4abfc549722
7
- data.tar.gz: cb15e80e14bc5c894a8ab33dae2c4a72924354fe033e67d2ad26c4bd6af1b1b2ad7691a23cd5dfb4002401ff7114bbeb2a793df9c2c4e0bcd566cfdc75105c02
6
+ metadata.gz: e158a6bdc13ea1ccd1923828b4c073c88412e7b515950c4a77bcf96d851bb0ea217c31fc68161b5a2d04cbbad49b19c76b1e7888294792eb01e1d84a1c0db7ed
7
+ data.tar.gz: 64e797566826df76b489829408a3865de303e50481558844c0d51b718ae80d93ac6fb162393249d81a317b60a4963ed78c7f2b3d80cd57c1825df0890b48806c
@@ -20,11 +20,20 @@ module DTRCore
20
20
  end
21
21
 
22
22
  def to_s
23
- "{ instruction: #{instruction}," \
23
+ "{ instruction: #{instruction}, " \
24
24
  "input: (#{inputs&.join(', ')}), " \
25
25
  "assign: #{assign}, scope: #{scope} }"
26
26
  end
27
27
 
28
+ def to_json(*_args)
29
+ {
30
+ instruction:,
31
+ inputs:,
32
+ assign:,
33
+ scope:
34
+ }.to_json
35
+ end
36
+
28
37
  def valid?
29
38
  DTRCore::InstructionValidator.new(self).valid?
30
39
  end
@@ -31,6 +31,8 @@ module DTRCore
31
31
  validate_object_operation!
32
32
  when 'add', 'subtract', 'multiply', 'divide'
33
33
  validate_binary_operation!
34
+ when 'increment'
35
+ true
34
36
  else
35
37
  false
36
38
  end
@@ -28,9 +28,15 @@ module DTRCore
28
28
  end
29
29
 
30
30
  def self.transform_attributes(capture_attribute_definition)
31
- capture_attribute_definition&.map { |x| x.split(':') }
32
- &.filter { |x| x.length > 1 }
33
- &.map { |x| { name: x[0].strip, type: x[1].strip } }
31
+ capture_attribute_definition&.map do |x|
32
+ splitted = x.split(':')
33
+ next { name: splitted[0].strip, type: splitted[1].strip } if splitted.length > 1
34
+
35
+ splitted = x.split('=')
36
+ next { name: splitted[0].strip, value: splitted[1].strip } if splitted.length > 1
37
+
38
+ nil
39
+ end&.compact
34
40
  end
35
41
 
36
42
  def self.capture_name(definition)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtr_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Durst
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-21 00:00:00.000000000 Z
11
+ date: 2024-06-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Core smart contract intermediate language (Digicus Textual Representation)
14
14
  parser.