Class: Gumdrop::Data::YAMLDBDataProvider
- Inherits:
-
Provider
- Object
- Provider
- Gumdrop::Data::YAMLDBDataProvider
show all
- Defined in:
- lib/gumdrop/data_providers/yamldb.rb
Instance Method Summary
collapse
Methods inherited from Provider
extensions, for, registered_exts, #supply_data
Instance Method Details
#available? ⇒ Boolean
6
7
8
9
10
11
|
# File 'lib/gumdrop/data_providers/yamldb.rb', line 6
def available?
require 'yaml'
true
rescue LoadError
false
end
|
#data_for(filepath) ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/gumdrop/data_providers/yamldb.rb', line 13
def data_for(filepath)
docs=[]
File.open(filepath, 'r') do |f|
YAML.load_documents(f) do |doc|
docs << supply_data( doc ) end
end
docs
end
|