Error in Lib file function

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

On 27 Feb 2008, at 13:58, Vasanthakumar C. 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

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 C. wrote:

On 27 Feb 2008, at 13:58, Vasanthakumar C. 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