Sha256: d4d690e6ad95501e199a1992e8ff48c470a2b87be54ec28b14d737f0add905bc

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

require_relative "../lib/procemon.rb"

test= Proc.new do |*params|

  puts "some awsome code here"

end

def hello_this sup,yo,lazy=nil

  puts "this is the Body!"

end


method_source= method(:hello_this).source
#Proc.new{ |sup,yo,lazy=nil,*params|
#
#  puts "this is the Body!"
#
#}

proc_source= test.source
#Proc.new{ |*params|
#
#  puts "some awsome code here"
#
#}

puts Proc.new{|e| puts e }.source.body

Process.exit

# example for terminal run
puts method_source
puts method_source.body,"---------"
puts method_source.params,"---------"
puts method_source.parameters.inspect,"---------"
puts method_source.params.inspect,"---------"

puts "\n"

merged_proc= ( method_source.body +
    proc_source.body
).build(*(method_source.params+proc_source.params))
puts merged_proc
puts merged_proc.to_proc
puts merged_proc.to_proc.source


#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

class A

  class << self

    def hello test=nil
      puts "world!"
    end

  end

  def self.singleton test=nil
    puts "singleton"
  end

  def instance          hello= "wolrd"
    puts "instance"
  end

end

puts A.instance_method(:instance).source

puts A.method(:singleton).source


#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
procemon-0.6.3 examples/fun_with_procs_and_methods.rb
procemon-0.6.2 examples/fun_with_procs_and_methods.rb
procemon-0.6.1 examples/fun_with_procs_and_methods.rb
procemon-0.5.0 examples/fun_with_procs_and_methods.rb