Module: Ddr::Contacts
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/ddr/contacts.rb
Class Attribute Summary collapse
-
.contacts ⇒ Object
Returns the value of attribute contacts.
Class Method Summary collapse
Class Attribute Details
.contacts ⇒ Object
Returns the value of attribute contacts.
6 7 8 |
# File 'lib/ddr/contacts.rb', line 6 def contacts @contacts end |
Class Method Details
.get(contact_slug) ⇒ Object
9 10 11 12 |
# File 'lib/ddr/contacts.rb', line 9 def self.get(contact_slug) load_contacts unless contacts contacts[contact_slug] end |
.load_contacts ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/ddr/contacts.rb', line 14 def self.load_contacts self.contacts = OpenStruct.new contacts_file = File.join(Rails.root, 'config', 'contacts.yml') YAML.load_file(contacts_file).each do |key, value| contacts[key] = OpenStruct.new(value.merge('slug' => key)) end rescue SystemCallError Rails.logger.warn("Unable to load Contacts file: #{contacts_file}") end |