Class: ConfigurationPageFacade

Inherits:
Object
  • Object
show all
Defined in:
lib/facades/configuration_page_facade.rb

Class Method Summary collapse

Class Method Details

.ApplyConfigurations(new_conf) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/facades/configuration_page_facade.rb', line 62

def self.ApplyConfigurations(new_conf)
  @configurations_hash.each do |rule, configurations|
    configurations.each do |configuration|

      case configuration.displayfield
      when DisplayField[:CheckBox]
        if new_conf.has_key?(configuration.id)
          configuration.value = true
        else
          configuration.value = false
        end

      when DisplayField[:SelectBox]
        configuration.value = new_conf[configuration.id].split(/\r?\n/).delete_if(&:empty?)

      when DisplayField[:RegexBox]
        configuration.value = if new_conf[configuration.id].empty? then new_conf[configuration.id] else Regexp.new new_conf[configuration.id] end
      else
        configuration.value = new_conf[configuration.id]
      end

    end
  end
end

.AssemblePageObject



7
8
9
10
11
12
13
# File 'lib/facades/configuration_page_facade.rb', line 7

def self.AssemblePage
  @configurations_hash = ConfigurationVisitor.Visit

  final_html = self.Title
  final_html += self.ConfigurationsForm
  return final_html
end