Sha256: 2e3630f596cef4f05a129e4828a86aaf68d1d22d46f402e6ff4960d7cd991844

Contents?: true

Size: 751 Bytes

Versions: 60

Compression:

Stored size: 751 Bytes

Contents

class PassAlong

  def self.all_variables(sender, receiver)
    sender.class.instance_methods(false).each do |method|
      new(sender, receiver, method).run
    end
  end

  attr_reader :sender, :receiver, :method

  def initialize(sender, receiver, method)
    @sender = sender
    @receiver = receiver
    @method = method
  end

  def run
    sender.class.after method do |*, obj|
      variables = get_variables_from(sender)
      variables.each do |var|
        receiver.instance_variable_set(var, sender.instance_variable_get(var))
      end
    end
  end

  private

  def get_variables_from(sender)
    variables = sender.instance_variables.dup
    variables.delete(:@context)
    variables.delete(:@delegate_sd_obj)
    variables
  end


end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
husky-0.5.15 lib/husky/pass_along.rb
husky-0.5.14 lib/husky/pass_along.rb
husky-0.5.13 lib/husky/pass_along.rb
husky-0.5.12 lib/husky/pass_along.rb
husky-0.5.11 lib/husky/pass_along.rb
husky-0.5.10 lib/husky/pass_along.rb
husky-0.5.9 lib/husky/pass_along.rb
husky-0.5.8 lib/husky/pass_along.rb
husky-0.5.7 lib/husky/pass_along.rb
husky-0.5.6 lib/husky/pass_along.rb
husky-0.5.5 lib/husky/pass_along.rb
husky-0.5.4 lib/husky/pass_along.rb
husky-0.5.3 lib/husky/pass_along.rb
husky-0.5.1 lib/husky/pass_along.rb
husky-0.5.0 lib/husky/pass_along.rb
husky-0.4.9 lib/husky/pass_along.rb
husky-0.4.8 lib/husky/pass_along.rb
husky-0.4.7 lib/husky/pass_along.rb
husky-0.4.6 lib/husky/pass_along.rb
husky-0.4.5 lib/husky/pass_along.rb