Ruby on Rails: Passing argument to singleton -


I have a railway app that repeatedly talks to another web server through a cover, and I want to stick in the cover is a single square, so it has not been created for every request. Quite easy, I thought:

  class AppWrapper & lt; Cover singleton is included in the end ... Cover = AppWrapper.instance "Url"  

Only this does not work:

  Wrong number of arguments (0 1) /usr/lib/ruby/1.8/singleton.rb:94:in`start '/usr/lib/ruby/1.8/singleton.rb: 94: in` new' /usr/lib/ruby/1.8 / Singleton .rb: 94: `example 'in  

Wrapper.in initialization requires an argument, and apparently it is not being passed, since the question is in line 94

  @__ example__ = new # showing, no logic  

How do I work on it? Start in AppWrapper does not seem to help redefine, and mucking around with the wrapper seems to be different from "starting" to "set url".

postproduct = A) @pdf = @pdf end DEF self.instance (P) a put @@ example start = Parameterized_Singleton .new (p) private_class_method: New Rescue NoMethodError # Return @@ Example # Or you can return the previous item "Object" Already created "exit end return @@ example end DEF scanwith (b) says" scan "end def show_frequence_distribution" fd puts "end def sho W_object_number (a) says "no" end-end Parameterized_Singleton.instance (20) .show_object_number (10) Parameterized_Singleton.instance (10) .show_object_number (20)

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -