Class: Property::Dspam

Inherits:
Property
  • Object
show all
Defined in:
app/models/property/dspam.rb

Instance Attribute Summary

Attributes inherited from Property

#collection, #multiple, #translate

Class Method Summary collapse

Methods inherited from Property

add, all_new_values, all_new_values_for_write, all_to_show, #has_new_value?, #input_type, #set_value

Class Method Details

.enum_template(a, locals) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'app/models/property/dspam.rb', line 27

def self.enum_template(a, locals)
  a.edit :file => "#{etc_dspam}/dspam.conf" do
    locals.each do |key, value|
      value = value.split(';').select {|s| sfirst=='+' }. first[1..-1]
      delete /^Preference\s+"#{key}/
      append "Preference\t\t\"#{key}=#{value}\""
    end
  end
end

.on_off_pref_template(a, locals) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'app/models/property/dspam.rb', line 8

def self.on_off_pref_template(a, locals)
  a.edit :file => "#{etc_dspam}/dspam.conf" do
    locals.each do |key, value|
      value = value == true or value == 'on' ? 'on' : 'off'
      delete /^Preference\s+"#{key}/
      append "Preference\t\t\"#{key}=#{value}\""
    end
  end
end

.preference_template(a, locals) ⇒ Object



18
19
20
21
22
23
24
25
# File 'app/models/property/dspam.rb', line 18

def self.preference_template(a, locals)
  a.edit :file => "#{etc_dspam}/dspam.conf" do
    locals.each do |key, value|
      delete /^Preference\s+"#{key}/
      append "Preference\t\t\"#{key}=#{value}\""
    end
  end
end

.serviceObject



3
# File 'app/models/property/dspam.rb', line 3

def self.service; DSPAM ;end