Class: Import::Resource

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/import/resource.rb

Direct Known Subclasses

NoRelation

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



14
15
16
# File 'lib/import/resource.rb', line 14

def logger
  @logger
end

#parent_import_idObject

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_variablesObject



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

#valuesObject



55
56
57
# File 'lib/import/resource.rb', line 55

def values
  @raw_resources
end