Class: Hyrax::Microdata

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
app/services/hyrax/microdata.rb

Constant Summary collapse

FILENAME =
Hyrax::Engine.root + 'config/schema_org.yml'
TOP_KEY =
'schema_org'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.load_pathObject

Allow clients to register paths providing config data sources. Register a config files like this:

Microdata.load_path << 'path/to/locale/en.yml'


18
19
20
# File 'app/services/hyrax/microdata.rb', line 18

def self.load_path
  @load_path ||= [FILENAME]
end

Class Method Details

.fetch(key, options = {}) ⇒ Object



7
8
9
# File 'app/services/hyrax/microdata.rb', line 7

def self.fetch(key, options = {})
  instance.fetch(key, options)
end

.reload!Object



27
28
29
# File 'app/services/hyrax/microdata.rb', line 27

def self.reload!
  instance.reload!
end

Instance Method Details

#fetch(key, options) ⇒ Object



11
12
13
# File 'app/services/hyrax/microdata.rb', line 11

def fetch(key, options)
  data.fetch(key) { options[:default] }
end

#reload!Object



31
32
33
# File 'app/services/hyrax/microdata.rb', line 31

def reload!
  @data = nil
end