Module: Acts::Importable::ClassMethods

Defined in:
lib/acts_as_importable.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_importable(options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/acts_as_importable.rb', line 10

def acts_as_importable(options = {})
  # Store the import target class with the legacy class
  write_inheritable_attribute :importable_to, options[:to]

  # Don't extend or include twice. This will allow acts_as_importable to be called multiple times.
  # eg. once in a parent class and once again in the child class, where it can override some options.
  extend  Acts::Importable::SingletonMethods unless self.methods.include?('import') && self.methods.include?('import_all')
  include Acts::Importable::InstanceMethods unless self.included_modules.include?(Acts::Importable::InstanceMethods)
end