Sha256: 4f8b274ed3c73598ca8d9be7a585d0d32067136616c2aa243ffd33347eb20948

Contents?: true

Size: 443 Bytes

Versions: 44

Compression:

Stored size: 443 Bytes

Contents

module Lookbook
  class YamlResolver < DataResolver
    MATCHER = /((?:\{|\[)(.*?)(?:\]|\}))$/m
    MATCH_INDEX = 1

    def self.resolveable?(input)
      input.to_s.match?(MATCHER) && YamlParser.call(input, fail_silently: true)
    end

    protected

    def resolve(input)
      YamlParser.call(input)
    rescue Psych::SyntaxError => exception
      raise_error "YAML parse error (#{exception}) in '#{file}'", exception
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
lookbook-2.3.4 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.3.3 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.3.2 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.3.0 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.2.2 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.2.1 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.2.0 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.1.1 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.1.0 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.0.5 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.0.4 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.0.3 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.0.2 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.0.1 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.0.0 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.0.0.rc.3 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-1.5.5 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-1.5.4 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.0.0.rc.2 lib/lookbook/services/data/resolvers/yaml_resolver.rb
lookbook-2.0.0.rc.1 lib/lookbook/services/data/resolvers/yaml_resolver.rb