Class: DigicusWebBackend::Compiler
- Inherits:
-
Object
- Object
- DigicusWebBackend::Compiler
- Defined in:
- lib/digicus_web_backend/compiler.rb
Overview
This is a simple compiler class that takes a DTR code and transpiles it to JSON.
Instance Attribute Summary collapse
-
#contract ⇒ Object
readonly
Returns the value of attribute contract.
Class Method Summary collapse
Instance Method Summary collapse
- #from_dtr ⇒ Object
-
#initialize(dtr_code) ⇒ Compiler
constructor
A new instance of Compiler.
Constructor Details
#initialize(dtr_code) ⇒ Compiler
Returns a new instance of Compiler.
11 12 13 |
# File 'lib/digicus_web_backend/compiler.rb', line 11 def initialize(dtr_code) @contract = DTRCore::Contract.from_dtr_raw(dtr_code) end |
Instance Attribute Details
#contract ⇒ Object (readonly)
Returns the value of attribute contract.
9 10 11 |
# File 'lib/digicus_web_backend/compiler.rb', line 9 def contract @contract end |
Class Method Details
.from_dtr(dtr_code) ⇒ Object
15 16 17 |
# File 'lib/digicus_web_backend/compiler.rb', line 15 def self.from_dtr(dtr_code) new(dtr_code).from_dtr end |
Instance Method Details
#from_dtr ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/digicus_web_backend/compiler.rb', line 19 def from_dtr result = { contract_name:, contract_state:, contract_interface:, contract_user_defined_types: } result.to_json end |