Class: Import::Resource
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Import::Resource
- Defined in:
- lib/import/resource.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#parent_import_id ⇒ Object
Returns the value of attribute parent_import_id.
Instance Method Summary collapse
- #add_resource(resource) ⇒ Object
- #collection(force = true) ⇒ Object
- #initialize_variables ⇒ Object
- #values ⇒ Object
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
14 15 16 |
# File 'lib/import/resource.rb', line 14 def logger @logger end |
#parent_import_id ⇒ Object
Returns the value of attribute parent_import_id.
14 15 16 |
# File 'lib/import/resource.rb', line 14 def parent_import_id @parent_import_id end |
Instance Method Details
#add_resource(resource) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/import/resource.rb', line 41 def add_resource(resource) resource = resource.gsub('*', '').strip return if resource.blank? || @raw_resources.include?(resource) @raw_resources << resource resource = parse_resource(resource.strip) @parsed_resources << resource append_existing_resources_criteria(resource) resource end |
#collection(force = true) ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/import/resource.rb', line 59 def collection(force = true) if force @existing_collection = find_existing_resources else @existing_collection ||= find_existing_resources end end |
#initialize_variables ⇒ Object
37 38 39 |
# File 'lib/import/resource.rb', line 37 def initialize_variables @raw_resources, @parsed_resources, @existing_resources_criteria, @existing_resources_criteria_values = [], [], [], [] end |
#values ⇒ Object
55 56 57 |
# File 'lib/import/resource.rb', line 55 def values @raw_resources end |