Sha256: 029cea54c6265c9e39d4e8d4fd58776d7d1f9e86ed793c127ea3da50c123ba71

Contents?: true

Size: 550 Bytes

Versions: 4

Compression:

Stored size: 550 Bytes

Contents

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pears-0.0.11 lib/pears/provider/base.rb
pears-0.0.10 lib/pears/provider/base.rb
pears-0.0.9 lib/pears/provider/base.rb
pears-0.0.8 lib/pears/provider/base.rb