Class: Hybag::Ingester
- Inherits:
-
Object
- Object
- Hybag::Ingester
- Defined in:
- lib/hybag/ingester.rb
Instance Attribute Summary collapse
-
#bag ⇒ Object
Returns the value of attribute bag.
-
#model_name ⇒ Object
Returns the value of attribute model_name.
-
#old_subject ⇒ Object
Returns the value of attribute old_subject.
Instance Method Summary collapse
- #ingest ⇒ Object
-
#initialize(bag) ⇒ Ingester
constructor
A new instance of Ingester.
Constructor Details
#initialize(bag) ⇒ Ingester
Returns a new instance of Ingester.
6 7 8 |
# File 'lib/hybag/ingester.rb', line 6 def initialize(bag) @bag = bag end |
Instance Attribute Details
#bag ⇒ Object
Returns the value of attribute bag.
5 6 7 |
# File 'lib/hybag/ingester.rb', line 5 def bag @bag end |
#model_name ⇒ Object
Returns the value of attribute model_name.
5 6 7 |
# File 'lib/hybag/ingester.rb', line 5 def model_name @model_name end |
#old_subject ⇒ Object
Returns the value of attribute old_subject.
5 6 7 |
# File 'lib/hybag/ingester.rb', line 5 def old_subject @old_subject end |
Instance Method Details
#ingest ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/hybag/ingester.rb', line 10 def ingest raise Hybag::UndiscoverableModelName.new(bag) if model_name.blank? new_object = model_name.constantize.new # Assign a pid new_object.inner_object.pid = new_object.inner_object.assign_pid (new_object) set_file_streams(new_object) return new_object end |