Sha256: 77e77be27b872200d00c92e1ad65b73a3d3ce7194a00af92789c0d230f8935fc
Contents?: true
Size: 910 Bytes
Versions: 22
Compression:
Stored size: 910 Bytes
Contents
# frozen_string_literal: true require 'hako/error' require 'hako/jsonnet_loader' require 'hako/yaml_loader' require 'pathname' module Hako class Application # @!attribute [r] id # @return [String] # @!attribute [r] root_path # @return [Pathname] # @!attribute [r] definition # @return [Hash] attr_reader :id, :root_path, :definition def initialize(definition_path, expand_variables: true, ask_keys: false) path = Pathname.new(definition_path) @id = path.basename.sub_ext('').to_s @root_path = path.parent @definition = case path.extname when '.yml', '.yaml' YamlLoader.new.load(path) when '.jsonnet', '.json' JsonnetLoader.new(self, expand_variables: expand_variables, ask_keys: ask_keys).load(path) else raise Error.new("Unknown extension: #{path}") end end end end
Version data entries
22 entries across 22 versions & 1 rubygems