Sha256: 43784b79ddf2001cd0f311a0f831974363ae74586eba417741f6d52e828a24f2

Contents?: true

Size: 1.52 KB

Versions: 27

Compression:

Stored size: 1.52 KB

Contents

module Foobara
  module Manifest
    class Command < BaseManifest
      self.category_symbol = :command

      def command_manifest
        relevant_manifest
      end

      def command_name
        scoped_short_name
      end

      def full_command_name
        scoped_full_name
      end

      def inputs_type
        Attributes.new(root_manifest, [*path, :inputs_type])
      end

      def result_type
        TypeDeclaration.new(root_manifest, [*path, :result_type])
      rescue Foobara::Manifest::InvalidPath
        nil
      end

      def possible_errors
        super.keys.to_h do |key|
          [key, PossibleError.new(root_manifest, [*path, :possible_errors, key])]
        end
      end

      def types_depended_on
        @types_depended_on ||= self[:types_depended_on].map do |type_reference|
          Type.new(root_manifest, [:type, type_reference])
        end
      end

      def inputs_types_depended_on
        @inputs_types_depended_on ||= self[:inputs_types_depended_on].map do |type_reference|
          Type.new(root_manifest, [:type, type_reference])
        end
      end

      def result_types_depended_on
        @result_types_depended_on ||= self[:result_types_depended_on].to_set do |type_reference|
          Type.new(root_manifest, [:type, type_reference])
        end
      end

      def errors_types_depended_on
        @errors_types_depended_on ||= self[:errors_types_depended_on].to_set do |type_reference|
          Type.new(root_manifest, [:type, type_reference])
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
foobara-0.0.7 projects/manifest/src/foobara/manifest/command.rb
foobara-0.0.6 projects/manifest/src/foobara/manifest/command.rb
foobara-0.0.5 projects/manifest/src/foobara/manifest/command.rb
foobara-0.0.4 projects/manifest/src/foobara/manifest/command.rb
foobara-0.0.3 projects/manifest/src/foobara/manifest/command.rb
foobara-0.0.2 projects/manifest/src/foobara/manifest/command.rb
foobara-0.0.1 projects/manifest/src/foobara/manifest/command.rb