Sha256: 05e9dd39c37d87ea8ed7029e4427e59b51c528b3f2892e9fb4938b658d1cb4f7

Contents?: true

Size: 721 Bytes

Versions: 1

Compression:

Stored size: 721 Bytes

Contents

# frozen_string_literal: true

module Manifold
  module API
    # Describes the entities for whom metrics are calculated.
    class Vector
      attr_reader :name, :template_path

      DEFAULT_TEMPLATE_PATH = File.expand_path(
        "../templates/vector_template.yml", __dir__
      ).freeze

      def initialize(name, template_path: DEFAULT_TEMPLATE_PATH)
        @name = name
        @template_path = Pathname(template_path)
      end

      def add
        directory.mkpath
        FileUtils.cp(template_path, config_path)
      end

      private

      def directory
        Pathname.pwd.join("vectors")
      end

      def config_path
        directory.join("#{name.downcase}.yml")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
manifold-cli-0.0.8 lib/manifold/api/vector.rb