Class: MongoDbUtils::ConfigProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/mongo-db-utils/console.rb

Overview

This is a workaround for this issue: github.com/JEG2/highline/issues/69 In ruby 2 + highline the yaml strings don’t get serialized correctly. The workaround is for any argument that is of type HighLine::String to call to_s on it

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ ConfigProxy

Returns a new instance of ConfigProxy.



14
15
16
# File 'lib/mongo-db-utils/console.rb', line 14

def initialize(config)
  @config = config
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (protected)



19
20
21
22
23
# File 'lib/mongo-db-utils/console.rb', line 19

def method_missing(name, *args, &block)
  cleaned_args = args.map { |a| trim(clean(a)) }
  cleaned_args.each { |a| puts "#{a} -> #{a.class}" }
  @config.send(name, *cleaned_args, &block)
end