lib/zertico/interactor.rb in zertico-1.3.0 vs lib/zertico/interactor.rb in zertico-2.0.0.alpha.1
- old
+ new
@@ -6,13 +6,26 @@
def rollback
true
end
+ def inject_instances(instances = {})
+ instances.each do |instance_name, instance_variable|
+ instance_variable_set("@#{instance_name}", instance_variable)
+ end
+ end
+
+ def get_instances
+ instance_variables.inject({}) do |instances, instance_variable|
+ instances[instance_variable.to_s.gsub('@', '')] = instance_variable_get(instance_variable)
+ instances
+ end
+ end
+
protected
- def self.instance_name
- self.class.to_s.chomp('Interactor').split('::').last
+ def self.interface_name
+ self.to_s.chomp('Interactor').split('::').last
end
private
def fail!(message = '')
\ No newline at end of file