Class: Opensteam::ExtensionBase::Extension

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/opensteam/extension_base.rb

Overview

Extension-Model

Direct Known Subclasses

Backend

Instance Method Summary collapse

Instance Method Details

#activate!Object

activate the extension



66
# File 'lib/opensteam/extension_base.rb', line 66

def activate! ; self.update_attribute( :active, 1 ) ; end

#active?Boolean

Returns:

  • (Boolean)


63
# File 'lib/opensteam/extension_base.rb', line 63

def active? ; active == 0 ? false : true ; end

#deactivate!Object

deactivate the extension



69
# File 'lib/opensteam/extension_base.rb', line 69

def deactivate! ; self.update_attribute( :active, 0 ) ; end

#verify_pathObject

verify the extension-path if path doesn’t exist, set error and deactivate extension if path exist, delete previous error-message.



75
76
77
78
79
80
81
82
83
# File 'lib/opensteam/extension_base.rb', line 75

def verify_path
  if File.exists?( self.path )
    self.error = nil
    self.save
  else
    self.error = "Extensions-Path '#{self.path}' not found!"
    self.deactivate!
  end
end