<commit_before>require File.expand_path("#{File.dirname(__FILE__)}/megam_attributes")
require File.expand_path("#{File.dirname(__FILE__)}/common_deployable")
require File.expand_path("#{File.dirname(__FILE__)}/outputs")

module Megam
  class Mixins
    class Components
      attr_reader :mixins, :name, :repo, :related_components, :operations, :artifacts, :outputs
      def initialize(params)
        @mixins = CommonDeployable.new(params)
        @name = params[:componentname]
        @outputs = Outputs.new(params)
        @operations = add_operations(params)
        @related_components = add_related_components(params)
        @artifacts = add_artifacts(params)
        @repo = add_repo(params)
      end

      def to_hash
        result = @mixins.to_hash
        result[:name]  = @name if @name
        result[:artifacts]  = @artifacts if @artifacts
        result[:repo]  = @repo if @repo
        result[:operations]  = @operations if @operations
        result[:outputs] = @outputs.to_array  if @outputs
        result[:related_components] = @related_components if @related_components
        result
      end

	def to_a
		[to_hash]
	end

      private

      def add_repo(params)
        Repo.new(params).tohash
      end

      def add_related_components(params)
	related_components = []
        related_components << "#{params[:assemblyname]}.#{params[:domain]}/#{params[:componentname]}" if params.key?(:bind_type)
      end

      def add_operations(params)
        operations = []
        operations.push(create_operation(Operations::CI, Operations::CI_DESCRIPTON,  params)) unless params[:scm_name].strip.empty?
        operations.push(create_operation(Operations::BIND, Operations::BIND_DESCRIPTON, params))
      end

      def create_operation(type, desc, params)
        Operations.new(params, type, desc).tohash<commit_msg>remove bind call<commit_after>require File.expand_path("#{File.dirname(__FILE__)}/megam_attributes")
require File.expand_path("#{File.dirname(__FILE__)}/common_deployable")
require File.expand_path("#{File.dirname(__FILE__)}/outputs")

module Megam
  class Mixins
    class Components
      attr_reader :mixins, :name, :repo, :related_components, :operations, :artifacts, :outputs
      def initialize(params)
        @mixins = CommonDeployable.new(params)
        @name = params[:componentname]
        @outputs = Outputs.new(params)
        @operations = add_operations(params)
        @related_components = add_related_components(params)
        @artifacts = add_artifacts(params)
        @repo = add_repo(params)
      end

      def to_hash
        result = @mixins.to_hash
        result[:name]  = @name if @name
        result[:artifacts]  = @artifacts if @artifacts
        result[:repo]  = @repo if @repo
        result[:operations]  = @operations if @operations
        result[:outputs] = @outputs.to_array  if @outputs
        result[:related_components] = @related_components if @related_components
        result
      end

	def to_a
		[to_hash]
	end

      private

      def add_repo(params)
        Repo.new(params).tohash
      end

      def add_related_components(params)
	related_components = []
        related_components << "#{params[:assemblyname]}.#{params[:domain]}/#{params[:componentname]}" if params.key?(:bind_type)
      end

      def add_operations(params)
        operations = []
        operations.push(create_operation(Operations::CI, Operations::CI_DESCRIPTON,  params)) unless params[:scm_name].strip.empty?
        operations.push(create_operation(Operations::BIND, Operations::BIND_DESCRIPTON, params)) if params.key?(:bind_type)
      end

      def create_operation(type, desc, params)
        Operations.new(params, type, desc).tohash
{'fraction_non_alphanumeric': 0.11418592154755508, 'fraction_numerical': 0.0, 'mean_word_length': 3.4427207637231505, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7033882', 'n_tokens_mistral': 1091, 'n_tokens_neox': 1088, 'n_words': 209}