Sha256: 64e6fd1d8bdf420ffb2e36d688465a80d19942fc0312172ed80177d9e1f42d79

Contents?: true

Size: 846 Bytes

Versions: 24

Compression:

Stored size: 846 Bytes

Contents

# encoding: utf-8

module Backup
  module Notifier
    class Binder

      ##
      # Shortcut to create a new instance of a binder, setting
      # the instance variables using a Hash of key/values and getting
      # the instance's binding. This returns the binding of the new Binder instance
      def self.bind(key_and_values = {})
        Binder.new(key_and_values).get_binding
      end

      ##
      # Creates a new Backup::Notifier::Binder instance. Loops through the provided
      # Hash to set instance variables
      def initialize(key_and_values)
        key_and_values.each do |key, value|
          instance_variable_set("@#{key}", value)
        end
      end

      ##
      # Returns the binding (needs a wrapper method because #binding is a private method)
      def get_binding
        binding
      end

    end
  end
end

Version data entries

24 entries across 24 versions & 3 rubygems

Version Path
backup-3.0.19 lib/backup/notifier/binder.rb
backup-3.0.18 lib/backup/notifier/binder.rb
interu-backup-3.0.16 lib/backup/notifier/binder.rb
backup-3.0.16 lib/backup/notifier/binder.rb
backup-3.0.15 lib/backup/notifier/binder.rb
backup-3.0.14 lib/backup/notifier/binder.rb
backup-3.0.13 lib/backup/notifier/binder.rb
backup-3.0.12 lib/backup/notifier/binder.rb
backup-3.0.11 lib/backup/notifier/binder.rb
alg-backup-3.0.10 lib/backup/notifier/binder.rb
backup-3.0.10 lib/backup/notifier/binder.rb
backup-3.0.9 lib/backup/notifier/binder.rb
backup-3.0.8 lib/backup/notifier/binder.rb
backup-3.0.7 lib/backup/notifier/binder.rb
backup-3.0.6 lib/backup/notifier/binder.rb
backup-3.0.5 lib/backup/notifier/binder.rb
backup-3.0.4 lib/backup/notifier/binder.rb
backup-3.0.3 lib/backup/notifier/binder.rb
backup-3.0.2.build.0 lib/backup/notifier/binder.rb
backup-3.0.2 lib/backup/notifier/binder.rb