dtr_core 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dtr_core/contract.rb +6 -0
- data/lib/dtr_core/parser.rb +7 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9594c7bac85d086ec888836ba17242023cadaccc4f6d4dc268520035324e682b
|
4
|
+
data.tar.gz: a9cb05cd8ac136ebaf433b7f7f6c6d2fc64f60e807588b59f435a056311a2374
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 189ffb27f3065aaa6d09bb5da75b693abe88236e073792aea4b0f33a609fa9383d187cbb12bf246e5bb470476bb767b4c74f60067f7cfa3e51a24383f742ff46
|
7
|
+
data.tar.gz: a261d658929cd4c9208f47ccebafc3d5b9b065fb328a184637fad60c843d6a000ec4cbbf736b57e9a4152be1e2433dd2bfb13b86319a653c7cec25a3d71b122a
|
data/lib/dtr_core/contract.rb
CHANGED
@@ -17,6 +17,12 @@ module DTRCore
|
|
17
17
|
new(parser.name_section, parser.state_section, parser.function_section)
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.from_dtr_raw(content)
|
21
|
+
parser = DTRCore::Parser.new('', content:)
|
22
|
+
|
23
|
+
new(parser.name_section, parser.state_section, parser.function_section)
|
24
|
+
end
|
25
|
+
|
20
26
|
def ==(other)
|
21
27
|
name == other.name &&
|
22
28
|
state == other.state &&
|
data/lib/dtr_core/parser.rb
CHANGED
@@ -7,10 +7,14 @@ module DTRCore
|
|
7
7
|
class Parser
|
8
8
|
include ::DTRCore::Common
|
9
9
|
|
10
|
-
def initialize(file_path)
|
11
|
-
|
10
|
+
def initialize(file_path, content: nil)
|
11
|
+
if content
|
12
|
+
@content = content
|
13
|
+
else
|
14
|
+
raise "Unable to find file: #{file_path}." unless File.exist?(file_path)
|
12
15
|
|
13
|
-
|
16
|
+
@content = File.read(file_path)
|
17
|
+
end
|
14
18
|
end
|
15
19
|
|
16
20
|
attr_reader :content
|
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.1.
|
4
|
+
version: 0.1.2
|
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-05-
|
11
|
+
date: 2024-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Core smart contract intermediate language (Digicus Textual Representation)
|
14
14
|
parser.
|