Class: AboutPage::Configuration::Node

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/about_page/configuration.rb

Direct Known Subclasses

Dependencies, Environment, Fedora, Solr

Instance Method Summary collapse

Instance Method Details

#add_header(response, text) ⇒ Object



86
87
88
89
90
# File 'lib/about_page/configuration.rb', line 86

def add_header response, text
  response.headers['X-AboutPage-Warning'] ||= "" 
  response.headers['X-AboutPage-Warning'] += "#{self.class.name}: #{text};"
  
end

#expects(key) ⇒ Object



73
74
75
# File 'lib/about_page/configuration.rb', line 73

def expects key 
  @request_expectations["#{namespace}.#{key}"] || self.options[:expects][key] if @request_expectations
end

#messagesObject



77
78
79
80
# File 'lib/about_page/configuration.rb', line 77

def messages
  run_validations!
  errors.to_a.uniq
end

#preflight(request) ⇒ Object



68
69
70
71
# File 'lib/about_page/configuration.rb', line 68

def preflight request
  errors.clear
  @request_expectations = request.params.select { |k,v| k =~ /^#{namespace}\./ }
end

#set_headers!(response) ⇒ Object



82
83
84
# File 'lib/about_page/configuration.rb', line 82

def set_headers! response
  messages.each { |m| add_header(response, m) }
end