Module: Etherlite::Railties::Utils
- Defined in:
- lib/etherlite/railties/utils.rb
Class Method Summary collapse
Class Method Details
.load_contracts(_path, prefix: 'Contract') ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/etherlite/railties/utils.rb', line 3 def self.load_contracts(_path, prefix: 'Contract') Dir.glob(_path.join('**/*.json')).map do |fullpath| path = Pathname.new fullpath path = path.relative_path_from _path path = path.dirname.join(path.basename(path.extname)).to_s Object.const_set(path.camelize + prefix, Etherlite::Abi.load_contract_at(fullpath)) end end |