# Re: passing function into another function

**URL:** <https://www.ruby-forum.com/t/re-passing-function-into-another-function/68359>\
**Category:** Ruby\
**Created:** [September 12, 2006, 1:13am UTC](https://www.ruby-forum.com/t/re-passing-function-into-another-function/68359 "2006-09-12T01:13:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![phrogz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/2acd7d/32.png) [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Post date:** [September 12, 2006, 1:13am UTC](https://www.ruby-forum.com/t/re-passing-function-into-another-function/68359/1 "2006-09-12T01:13:26Z")

</div>

From: Joe Van D. [[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)]

> def do\_something\_with\_a\_report report
> 
> # calls Reports::This or Reports::That, dtermined by what report is
> 
> # something like report.call ?
> 
> end

class Reports  
def self.this  
puts “#{self} is doing ‘this’”  
end  
def self.that  
puts “#{self} is doing ‘that’”  
end  
def self.run\_report( report\_name )  
send( report\_name )  
end  
end

def do\_something\_with\_a\_report( report\_name )  
Reports.run\_report( report\_name )  
end

do\_something\_with\_a\_report( :this )  
#=\> Reports is doing ‘this’

def do\_something\_with\_a\_report2( report )  
report.call  
end

do\_something\_with\_a\_report2( Reports.method( :this ) )  
#=\> Reports is doing ‘this’
