lib/pears/provider/base.rb in pears-0.0.7 vs lib/pears/provider/base.rb in pears-0.0.8

- old
+ new

@@ -1,18 +1,31 @@ module Pears module Provider class Base attr_accessor :data + + def initialize(data, on_failure: :raise) + @data = data + end + def has_key?(key) @data.has_key? key end def each(&block) @data.block(&:yield) end def [](key) @data[key] + end + + private + + def parse_yaml(yaml_data) + yaml_data = YAML.load(yaml_data) + raise Pears::InvalidProviderData if yaml_data.is_a? String + yaml_data.with_indifferent_access end end end end