Sha256: 57a1d074a64e4988b4ea7b3d5ab26412ca079a8291bbbffc44b54a300ab2c02a

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 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"
#
#}

# 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

10 entries across 10 versions & 1 rubygems

Version Path
procemon-0.4.5 examples/fun_with_procs_and_methods.rb
procemon-0.4.4 examples/fun_with_procs_and_methods.rb
procemon-0.4.3 examples/fun_with_procs_and_methods.rb
procemon-0.4.2 examples/fun_with_procs_and_methods.rb
procemon-0.4.1 examples/fun_with_procs_and_methods.rb
procemon-0.4.0 examples/fun_with_procs_and_methods.rb
procemon-0.3.4 examples/fun_with_procs_and_methods.rb
procemon-0.3.3 examples/fun_with_procs_and_methods.rb
procemon-0.3.2 examples/fun_with_procs_and_methods.rb
procemon-0.3.1 examples/fun_with_procs_and_methods.rb