Hi Everyone, I have the following two functions in "global_functions.rb", # Decription : Function to get minimum between two input values # Input : x & y - any two number # Output : Minimum number of 2 input values def self.getMinimumValue(x, y) if(x <= y) @min_value = x else @min_value = y end return @min_value end # Decription : Function to get maximum between two input values # Input : x & y - any two number # Output : Maximum number of 2 input values def self.getMaximumValue(x, y) if(x >= y) @max_value = x else @max_value = y end return @max_value end So, If i try to access "getMaximumValue" like GlobalFunctions.getMaximumValue it shows an error like "undefined method `getMaximumValue` for GlobalFunctions:Class". However, if i remove "getMaximumValue" from that file and have only "getMinimumValue" then its working fine. I dont know how this is working. Is there any function limit for a Lib class? Please help me out of this problem. Thanks in advance. Regards, VASANTH -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 27 Feb 2008, at 13:58, Vasanthakumar Csk wrote:> > > So, If i try to access "getMaximumValue" like > GlobalFunctions.getMaximumValue it shows an error like "undefined > method > `getMaximumValue` for GlobalFunctions:Class". > However, if i remove "getMaximumValue" from that file and have only > "getMinimumValue" then its working fine. I dont know how this is > working. Is there any function limit for a Lib class? >It''s probably something to do with the other bits of that file. There''s certainly no limit on the number of methods you can declare (although you could rewrite those functions as [x,y].min and [x,y].max Fred> Please help me out of this problem. > Thanks in advance. > Regards, > VASANTH > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Cheung....thanks for ur suggestion. And i have found the reason for my error, its the file name "global_functions.rb". Which i changed to "global_function.rb" and accessed the functions like GlobalFunction.getMaximumValue. Now everything is working fine. Even though i found the problem, i am not sure why it is behaving like that. Is it related to that singular/plural naming conventions that Rails follows? Is there any explanation for this? Just curious to know the actual problem. Thanks in advance. Regards, VASANTH Frederick Cheung wrote:> On 27 Feb 2008, at 13:58, Vasanthakumar Csk wrote: >> >> >> So, If i try to access "getMaximumValue" like >> GlobalFunctions.getMaximumValue it shows an error like "undefined >> method >> `getMaximumValue` for GlobalFunctions:Class". >> However, if i remove "getMaximumValue" from that file and have only >> "getMinimumValue" then its working fine. I dont know how this is >> working. Is there any function limit for a Lib class? >> > It''s probably something to do with the other bits of that file. > There''s certainly no limit on the number of methods you can declare > (although you could rewrite those functions as [x,y].min and [x,y].max > > Fred-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---