Class: PactBroker::Client::DescribeTextFormatter
- Inherits:
-
Object
- Object
- PactBroker::Client::DescribeTextFormatter
- Extended by:
- GenerateDisplayName
- Defined in:
- lib/pact_broker/client/describe_text_formatter.rb
Class Method Summary collapse
Methods included from GenerateDisplayName
Class Method Details
.call(properties) ⇒ Object
9 10 11 |
# File 'lib/pact_broker/client/describe_text_formatter.rb', line 9 def self.call(properties) YAML.dump(displayify_keys(properties)).gsub("---\n", "") end |
.displayify_keys(thing) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/pact_broker/client/describe_text_formatter.rb', line 13 def self.displayify_keys(thing) case thing when Hash then thing.each_with_object({}) { | (key, value), new_hash | new_hash[generate_display_name(key)] = displayify_keys(value) } when Array then thing.collect{ | value | displayify_keys(value) } else thing end end |