Sha256: 13c08fc3e295041bbffe585c5c7107c1c2c1125aca0ece5d44c350fa98b8c057
Contents?: true
Size: 747 Bytes
Versions: 1
Compression:
Stored size: 747 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 unless yaml_data.is_a? Hash yaml_data.with_indifferent_access rescue Psych::SyntaxError => e logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT) logger.warn "#{e.class} #{e.message}" raise Pears::InvalidProviderData end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pears-0.1.2 | lib/pears/provider/base.rb |