Class: Backup::Notifier::Binder
- Inherits:
-
Object
- Object
- Backup::Notifier::Binder
- Defined in:
- lib/backup/notifier/binder.rb
Class Method Summary collapse
-
.bind(key_and_values = {}) ⇒ Object
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.
Instance Method Summary collapse
-
#get_binding ⇒ Object
Returns the binding (needs a wrapper method because #binding is a private method).
-
#initialize(key_and_values) ⇒ Binder
constructor
Creates a new Backup::Notifier::Binder instance.
Constructor Details
#initialize(key_and_values) ⇒ Binder
Creates a new Backup::Notifier::Binder instance. Loops through the provided Hash to set instance variables
18 19 20 21 22 |
# File 'lib/backup/notifier/binder.rb', line 18 def initialize(key_and_values) key_and_values.each do |key, value| instance_variable_set("@#{key}", value) end end |
Class Method Details
.bind(key_and_values = {}) ⇒ Object
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
11 12 13 |
# File 'lib/backup/notifier/binder.rb', line 11 def self.bind(key_and_values = {}) Binder.new(key_and_values).get_binding end |
Instance Method Details
#get_binding ⇒ Object
Returns the binding (needs a wrapper method because #binding is a private method)
26 27 28 |
# File 'lib/backup/notifier/binder.rb', line 26 def get_binding binding end |