tealrb 0.2.0 → 0.3.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: 232757505472510465b62384efb3502fd68bb6589cb543e5bdad87b8f29f82a0
4
- data.tar.gz: d6f98b807101a75092f86ff80749dc28cb42b20474706436fbdc2ba356211659
3
+ metadata.gz: 0e87d9c19e3fb930116e5a3a3d598140987feb20a0571b2f2fd70f1beb752b3b
4
+ data.tar.gz: 67b114fc5e032b9b9f733fb033bc619d209a4b1da4438606064f88306cd0fa2b
5
5
  SHA512:
6
- metadata.gz: 5d6f8f0e315cc9e045a4279e7d1a79a8a6d033218d830a93d20b72ef4bb7fb6f239007479763fcd99c89f46a0fee17478a47c67450cf560ca2c9c77a8e511a2b
7
- data.tar.gz: 89dfcbe94801a5fb0ad54c496472f6442fdb4126804fbe817ce5d5d3b4e32aec2360eae93d6fb72acac736c98c548761fe1f8eaa9b632ed8a9d6593005aa2ca7
6
+ metadata.gz: 61974eeb0c5454eb434ac0e36308c01ddc4ac51d7dfb8745a7b991e837e208589fbf9d014b47d2b66b876391052b2616ec2e26cffa1f92c0ab2e74db23fd01d4
7
+ data.tar.gz: 5f35f5248e16f6a684d3a37ab9d4a76f97f32ee24bcee43c1da7dc3082c044da1037da42a1495b3b8a1a3843d46a681f4a905b0d283ace884131b5815c60fe12
@@ -6,16 +6,17 @@ module TEALrb
6
6
  attr_accessor :id
7
7
  end
8
8
 
9
- @id = 0
9
+ @id = {}
10
10
 
11
11
  def initialize(teal, _cond, &blk)
12
+ self.class.id[teal] ||= 0
12
13
  @teal = teal
13
14
  @else_count = 0
14
- @id = self.class.id
15
+ @id = self.class.id[@teal]
15
16
  @end_label = "if#{@id}_end:"
16
17
 
17
- @id = self.class.id
18
- self.class.id += 1
18
+ @id = self.class.id[@teal]
19
+ self.class.id[@teal] += 1
19
20
 
20
21
  @teal << "bz if#{@id}_else0"
21
22
  blk.call
@@ -664,6 +664,20 @@ module TEALrb
664
664
  end
665
665
  end
666
666
 
667
+ class TxnArrayIndex
668
+ include Opcodes
669
+ include TxnFields
670
+
671
+ def initialize(index)
672
+ @index = index
673
+ end
674
+
675
+ def opcode(field)
676
+ @teal = TEALrb::TEAL.current[Thread.current]
677
+ txna field, @index
678
+ end
679
+ end
680
+
667
681
  module Txna
668
682
  extend Opcodes
669
683
  extend TxnFields
@@ -672,6 +686,10 @@ module TEALrb
672
686
  @teal = TEALrb::TEAL.current[Thread.current]
673
687
  txna field, index
674
688
  end
689
+
690
+ def self.[](index)
691
+ TxnArrayIndex.new(index)
692
+ end
675
693
  end
676
694
 
677
695
  module Global
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tealrb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Polny
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-12 00:00:00.000000000 Z
11
+ date: 2022-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: method_source
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.19.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.6.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.6.0
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: yard
113
127
  requirement: !ruby/object:Gem::Requirement