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

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.partialObject (readonly)

Returns the value of attribute partial.



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

def partial
  @partial
end

Class Method Details

.render_with(partial) ⇒ Object



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

def render_with partial
  @partial = partial
end

Instance Method Details

#add_header(response, text) ⇒ Object



93
94
95
96
# File 'lib/about_page/configuration.rb', line 93

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

#expects(key) ⇒ Object



80
81
82
# File 'lib/about_page/configuration.rb', line 80

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

#messagesObject



84
85
86
87
# File 'lib/about_page/configuration.rb', line 84

def messages
  run_validations!
  errors.to_a.uniq
end

#preflight(request) ⇒ Object



75
76
77
78
# File 'lib/about_page/configuration.rb', line 75

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

#set_headers!(response) ⇒ Object



89
90
91
# File 'lib/about_page/configuration.rb', line 89

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