Module: Pact::FileName
Instance Method Summary collapse
- #file_name(consumer_name, provider_name, options = {}) ⇒ Object
- #file_path(consumer_name, provider_name, pact_dir = Pact.configuration.pact_dir, options = {}) ⇒ Object
- #filenamify(name) ⇒ Object
- #windows_safe(pact_dir) ⇒ Object
Instance Method Details
#file_name(consumer_name, provider_name, options = {}) ⇒ Object
5 6 7 8 |
# File 'lib/pact/consumer_contract/file_name.rb', line 5 def file_name consumer_name, provider_name, = {} pid = [:unique] ? "-#{Process.pid}" : '' "#{filenamify(consumer_name)}-#{filenamify(provider_name)}#{pid}.json" end |
#file_path(consumer_name, provider_name, pact_dir = Pact.configuration.pact_dir, options = {}) ⇒ Object
10 11 12 |
# File 'lib/pact/consumer_contract/file_name.rb', line 10 def file_path consumer_name, provider_name, pact_dir = Pact.configuration.pact_dir, = {} File.join(windows_safe(pact_dir), file_name(consumer_name, provider_name, )) end |
#filenamify(name) ⇒ Object
14 15 16 |
# File 'lib/pact/consumer_contract/file_name.rb', line 14 def filenamify name name.downcase.gsub(/\s/, '_') end |
#windows_safe(pact_dir) ⇒ Object
18 19 20 |
# File 'lib/pact/consumer_contract/file_name.rb', line 18 def windows_safe(pact_dir) pact_dir.gsub("\\", "/") end |