class TaaS::Contracts
Public Class Methods
contains?(contract_name)
click to toggle source
# File lib/helper/contracts.rb, line 18 def self.contains?(contract_name) @@contract_hash.keys.include?(contract_name) end
get_all_contracts()
click to toggle source
# File lib/helper/contracts.rb, line 33 def self.get_all_contracts return @@contract_hash end
get_contract(contract_name)
click to toggle source
# File lib/helper/contracts.rb, line 22 def self.get_contract(contract_name) return nil unless contains?(contract_name) contract = Contract.new @@contract_hash[contract_name] contract end
get_execution_attribute(attribute, contract_name)
click to toggle source
# File lib/helper/contracts.rb, line 28 def self.get_execution_attribute(attribute, contract_name) return nil if @@contract_hash.nil? || @@contract_hash.eql?({}) @@contract_hash["contracts"][contract_name.to_s][attribute] end
is_empty?()
click to toggle source
# File lib/helper/contracts.rb, line 14 def self.is_empty? @@contract_hash.eql?({}) || @@contract_hash.nil? end
load(absolute_path)
click to toggle source
# File lib/helper/contracts.rb, line 8 def self.load(absolute_path) raise "File path cant be nil or empty" if (absolute_path.nil? || absolute_path.empty?) puts "Loading contracts file from #{absolute_path}" @@contract_hash = YAML.load_file(absolute_path)["contracts"] end