Class: Gumdrop::Data::YAMLandJSONDataProvider

Inherits:
Provider
  • Object
show all
Defined in:
lib/gumdrop/data_providers/yaml_and_json.rb

Instance Method Summary collapse

Methods inherited from Provider

extensions, for, registered_exts, #supply_data

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
# File 'lib/gumdrop/data_providers/yaml_and_json.rb', line 6

def available?
  require 'yaml'
  true
rescue LoadError
  false
end

#data_for(filepath) ⇒ Object



13
14
15
# File 'lib/gumdrop/data_providers/yaml_and_json.rb', line 13

def data_for(filepath)
  supply_data YAML.load_file(filepath)
end