tealrb 0.2.0 → 0.4.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: fa3ecdb5dd00d5242fc4606722bc6d6c80625f0dd042fe8a64aaec481fe4bb6d
4
+ data.tar.gz: 59ddc597857e55d7b0d6187325d0ff76e3e049403fcdf1ede00f2b3a9a1c2eaf
5
5
  SHA512:
6
- metadata.gz: 5d6f8f0e315cc9e045a4279e7d1a79a8a6d033218d830a93d20b72ef4bb7fb6f239007479763fcd99c89f46a0fee17478a47c67450cf560ca2c9c77a8e511a2b
7
- data.tar.gz: 89dfcbe94801a5fb0ad54c496472f6442fdb4126804fbe817ce5d5d3b4e32aec2360eae93d6fb72acac736c98c548761fe1f8eaa9b632ed8a9d6593005aa2ca7
6
+ metadata.gz: 3757a7177af88cef08ab3c780fde484210dc5c2a9667a6733815b72b5dfef2e1aeaa176c65ab48be5010cf973c40c1af04b33e3516f14a8bc818a58f5972776b
7
+ data.tar.gz: b508d5fa005be7eaf3adf738542c38a053240ccfa73d0de0c2b6410a0ad4358d7a31e90d2899d35aeafc1407955ae5f0ab96ae8083ec1b0aabaf7ffbcd937547
@@ -6,16 +6,16 @@ module TEALrb
6
6
  attr_accessor :id
7
7
  end
8
8
 
9
- @id = 0
9
+ @id = {}.compare_by_identity
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
+ self.class.id[@teal] += 1
19
19
 
20
20
  @teal << "bz if#{@id}_else0"
21
21
  blk.call
@@ -664,13 +664,40 @@ module TEALrb
664
664
  end
665
665
  end
666
666
 
667
- module Txna
668
- extend Opcodes
669
- extend TxnFields
667
+ class TxnaField
668
+ include Opcodes
670
669
 
671
- def self.opcode(field, index)
670
+ def initialize(field, index = nil)
671
+ @field = field
672
672
  @teal = TEALrb::TEAL.current[Thread.current]
673
- txna field, index
673
+ txna(field, index) if index
674
+ end
675
+
676
+ def [](index)
677
+ @teal = TEALrb::TEAL.current[Thread.current]
678
+ txna @field, index
679
+ end
680
+ end
681
+
682
+ module Txna
683
+ def self.application_args(index = nil)
684
+ TxnaField.new('ApplicationArgs', index)
685
+ end
686
+
687
+ def self.accounts(index = nil)
688
+ TxnaField.new('Accounts', index)
689
+ end
690
+
691
+ def self.assets(index = nil)
692
+ TxnaField.new('Assets', index)
693
+ end
694
+
695
+ def self.applications(index = nil)
696
+ TxnaField.new('Applications', index)
697
+ end
698
+
699
+ def self.logs(index = nil)
700
+ TxnaField.new('Logs', index)
674
701
  end
675
702
  end
676
703
 
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.4.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-16 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