Class: EvmClient::ProjectInitializer
- Inherits:
-
Object
- Object
- EvmClient::ProjectInitializer
- Defined in:
- lib/evm_client/project_initializer.rb
Instance Attribute Summary collapse
-
#combined_output ⇒ Object
Returns the value of attribute combined_output.
-
#contract_names ⇒ Object
Returns the value of attribute contract_names.
-
#contracts ⇒ Object
Returns the value of attribute contracts.
-
#libraries ⇒ Object
Returns the value of attribute libraries.
Instance Method Summary collapse
-
#initialize(location, optimize = false) ⇒ ProjectInitializer
constructor
A new instance of ProjectInitializer.
Constructor Details
#initialize(location, optimize = false) ⇒ ProjectInitializer
Returns a new instance of ProjectInitializer.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/evm_client/project_initializer.rb', line 7 def initialize(location, optimize = false) ENV['ETHEREUM_SOLIDITY_BINARY'] ||= "/usr/local/bin/solc" solidity = ENV['ETHEREUM_SOLIDITY_BINARY'] contract_dir = location if optimize opt_flag = "--optimize" else opt_flag = "" end compile_command = "#{solidity} #{opt_flag} --combined-json abi,bin #{contract_dir}" raw_data = `#{compile_command}` data = JSON.parse(raw_data) @contract_names = data["contracts"].keys @libraries = {} @contracts = @contract_names.collect do |contract_name| ContractInitializer.new(contract_name, data["contracts"][contract_name], self) end end |
Instance Attribute Details
#combined_output ⇒ Object
Returns the value of attribute combined_output.
5 6 7 |
# File 'lib/evm_client/project_initializer.rb', line 5 def combined_output @combined_output end |
#contract_names ⇒ Object
Returns the value of attribute contract_names.
5 6 7 |
# File 'lib/evm_client/project_initializer.rb', line 5 def contract_names @contract_names end |
#contracts ⇒ Object
Returns the value of attribute contracts.
5 6 7 |
# File 'lib/evm_client/project_initializer.rb', line 5 def contracts @contracts end |
#libraries ⇒ Object
Returns the value of attribute libraries.
5 6 7 |
# File 'lib/evm_client/project_initializer.rb', line 5 def libraries @libraries end |