T
Thillai S.
Hai any one pls guide me...
We can extract the line number of the sub routine/function/method in a
Ruby file using the ctags command.
But I want to know the line number in which the sub routine is ending.
Example:
Quote:
#
# Function name : get_days_in_hash
# Argument :
# no arguments
# Return value :
# days information in hash format.
# Description :
# get the days. Assigned value for each day.
# 1 => 'Mon' ,
# 2 => 'Tues' ,
# 3 => 'Wed' ,
# 4 => 'Thu' ,
# 5 => 'Fri' ,
# 6 => 'Sat' ,
# 7 => 'Sun' ,
# 8 => 'Leave' ,
# 9 => 'Holiday'
# Logical flow :
# generate the hash
#
def get_days_in_hash
{ 1 => 'Mon' , 2 => 'Tues' , 3 => 'Wed' , 4 => 'Thu' , 5 => 'Fri' , 6 =>
'Sat' , 7 => 'Sun' , 8 => 'Leave' , 9 => 'Holiday' }
end
Quote:
#
# Function name : user_filter
# Argument :
# get the controller and action.
# Return value :
# if the user not login then display the login page.
# Description :
# check the user is login or not.
# Logical flow :
# check the controller and action is not the login page or not.
# check the user is log-in or not.
# if not login then redirect the page to login page.
#
def user_filter()
# set the header information for the Browser
no_cache()
# check it is a login page or not.
# If it is not a not the login page then check the session whether he is
login or not
# if is not login then display the login page.
if( not ( params[:controller] == 'main' && ( params[:action] == 'login'
|| params[:action] == 'index' ) ) )
if( not session[:user_id] )
#redirect_to :controller => 'main' , :action => 'login'
if( params[:action] == 'logout' )
flash[:notice] = 'Logged out Successfully'
else
flash[:notice] = "Session Expired"
end
render :text => "<script>
window.location='#{url_forcontroller => 'main' , :action => 'login'
)}';
</script>"
end
end
end
Say the function get_days_in_hash starts in the line number 20.
It will be returned by the ctags command.
I want to know in which line number that appropriate function is ending.
For each functions in the file I want this informations like starting
line of the file and the ending line of the file.
Please help me about how to achieve this.
Thanks in Advance,
We can extract the line number of the sub routine/function/method in a
Ruby file using the ctags command.
But I want to know the line number in which the sub routine is ending.
Example:
Quote:
#
# Function name : get_days_in_hash
# Argument :
# no arguments
# Return value :
# days information in hash format.
# Description :
# get the days. Assigned value for each day.
# 1 => 'Mon' ,
# 2 => 'Tues' ,
# 3 => 'Wed' ,
# 4 => 'Thu' ,
# 5 => 'Fri' ,
# 6 => 'Sat' ,
# 7 => 'Sun' ,
# 8 => 'Leave' ,
# 9 => 'Holiday'
# Logical flow :
# generate the hash
#
def get_days_in_hash
{ 1 => 'Mon' , 2 => 'Tues' , 3 => 'Wed' , 4 => 'Thu' , 5 => 'Fri' , 6 =>
'Sat' , 7 => 'Sun' , 8 => 'Leave' , 9 => 'Holiday' }
end
Quote:
#
# Function name : user_filter
# Argument :
# get the controller and action.
# Return value :
# if the user not login then display the login page.
# Description :
# check the user is login or not.
# Logical flow :
# check the controller and action is not the login page or not.
# check the user is log-in or not.
# if not login then redirect the page to login page.
#
def user_filter()
# set the header information for the Browser
no_cache()
# check it is a login page or not.
# If it is not a not the login page then check the session whether he is
login or not
# if is not login then display the login page.
if( not ( params[:controller] == 'main' && ( params[:action] == 'login'
|| params[:action] == 'index' ) ) )
if( not session[:user_id] )
#redirect_to :controller => 'main' , :action => 'login'
if( params[:action] == 'logout' )
flash[:notice] = 'Logged out Successfully'
else
flash[:notice] = "Session Expired"
end
render :text => "<script>
window.location='#{url_forcontroller => 'main' , :action => 'login'
)}';
</script>"
end
end
end
Say the function get_days_in_hash starts in the line number 20.
It will be returned by the ctags command.
I want to know in which line number that appropriate function is ending.
For each functions in the file I want this informations like starting
line of the file and the ending line of the file.
Please help me about how to achieve this.
Thanks in Advance,