Class: SolidusContent::Providers::YAML
- Inherits:
-
Object
- Object
- SolidusContent::Providers::YAML
- Defined in:
- lib/solidus_content/providers/yaml.rb
Class Method Summary collapse
Class Method Details
.call(input) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/solidus_content/providers/yaml.rb', line 9 def call(input) dir = Rails.root.join(input.dig(:type_options, :path)) file = dir.join(input[:slug] + '.yml') file = dir.join(input[:slug] + '.yaml') unless file.exist? data = load(file) input.merge(data: data) end |
.entry_fields ⇒ Object
27 28 29 |
# File 'lib/solidus_content/providers/yaml.rb', line 27 def entry_fields [] end |
.entry_type_fields ⇒ Object
23 24 25 |
# File 'lib/solidus_content/providers/yaml.rb', line 23 def entry_type_fields %i[path] end |
.load(file) ⇒ Object
19 20 21 |
# File 'lib/solidus_content/providers/yaml.rb', line 19 def load(file) ::YAML.load_file(file).symbolize_keys end |