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, GitLog, Solr

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.partialObject (readonly)

Returns the value of attribute partial.



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

def partial
  @partial
end

Class Method Details

.render_with(partial) ⇒ Object



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

def render_with partial
  @partial = partial
end

Instance Method Details

#add_header(response, text) ⇒ Object



113
114
115
116
# File 'lib/about_page/configuration.rb', line 113

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

#expects(key) ⇒ Object



96
97
98
# File 'lib/about_page/configuration.rb', line 96

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

#messagesObject



100
101
102
103
# File 'lib/about_page/configuration.rb', line 100

def messages
  run_validations!
  errors.to_a.uniq
end

#preflight(request) ⇒ Object



91
92
93
94
# File 'lib/about_page/configuration.rb', line 91

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

#set_headers!(response) ⇒ Object



109
110
111
# File 'lib/about_page/configuration.rb', line 109

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

#to_hObject



105
106
107
# File 'lib/about_page/configuration.rb', line 105

def to_h
  nil
end