Module: Pact::ActiveSupportSupport
- Extended by:
- ActiveSupportSupport
- Included in:
- ActiveSupportSupport, ConsumerContract, Interaction, Term
- Defined in:
- lib/pact/consumer_contract/active_support_support.rb
Instance Method Summary collapse
Instance Method Details
#fix_all_the_things(thing) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/pact/consumer_contract/active_support_support.rb', line 6 def fix_all_the_things thing if thing.is_a?(Regexp) fix_regexp(thing) elsif thing.is_a?(Array) thing.each{ | it | fix_all_the_things it } elsif thing.is_a?(Hash) thing.values.each{ | it | fix_all_the_things it } elsif thing.class.name.start_with?("Pact") thing.instance_variables.collect{ | iv_name | thing.instance_variable_get(iv_name)}.each do | iv | fix_all_the_things iv end end thing end |
#fix_regexp(regexp) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/pact/consumer_contract/active_support_support.rb', line 21 def fix_regexp regexp def regexp.as_json = {} {:json_class => 'Regexp', "o" => self., "s" => self.source } end regexp end |