0

I need to get the content of a proc send to js by Opal ruby. I am only using the static version of Opal, Opal-native, opal-parser. how can I proceed ?

def parse_proc params
 #### how can I get proc content?
end

def touch(&proc)
    parse_proc proc
end

b=box()
c=circle()

b.touch do 
    b.color(:red)     
    c.x=200
end
Community
  • 1
  • 1

1 Answers1

0

I found a solution I think there must be an better way but it works :

def analysis_of_proc params
  the_proc_conent_is=`the_proc_conent_is = #{params}.toString();`     
  puts the_proc_conent_is  
end
def my_proc(&proc)
    analysis_of_proc proc
    proc.call
end
my_proc do 
    a="hello"
    b="world"
      def add_word fist, second
        return fist+" "+second
      end
    add_word a,b
end