Sha256: 17c6d65eca806c0ecbf49ec855aa2160068b00753a5646945c679e5114314398

Contents?: true

Size: 991 Bytes

Versions: 26

Compression:

Stored size: 991 Bytes

Contents

# frozen_string_literal: true

require 'active_support/core_ext/string/inflections'

module EacLauncher
  module Stereotype
    class << self
      attr_reader :stereotypes

      def included(base)
        @stereotypes ||= []
        @stereotypes << base
        base.extend(ClassMethods)
      end

      def git_stereotypes
        stereotypes.select { |c| c.name.demodulize.downcase.match('git') }
      end

      def nogit_stereotypes
        stereotypes - git_stereotypes
      end
    end

    module ClassMethods
      def stereotype_name
        name.gsub(/^.*::/, '')
      end

      def stereotype_name_in_color
        stereotype_name.send(color)
      end

      def publish_class
        sub_class('Publish')
      end

      def warp_class
        sub_class('Warp')
      end

      private

      def sub_class(sub_class_name)
        klass = const_get(sub_class_name)
        klass.is_a?(Class) ? klass : nil
      rescue NameError
        nil
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
avm-tools-0.58.1 lib/eac_launcher/stereotype.rb
avm-tools-0.58.0 lib/eac_launcher/stereotype.rb
avm-tools-0.57.0 lib/eac_launcher/stereotype.rb
avm-tools-0.56.0 lib/eac_launcher/stereotype.rb
avm-tools-0.55.0 lib/eac_launcher/stereotype.rb
avm-tools-0.54.2 lib/eac_launcher/stereotype.rb
avm-tools-0.54.1 lib/eac_launcher/stereotype.rb
avm-tools-0.54.0 lib/eac_launcher/stereotype.rb
avm-tools-0.53.0 lib/eac_launcher/stereotype.rb
avm-tools-0.52.0 lib/eac_launcher/stereotype.rb
avm-tools-0.51.0 lib/eac_launcher/stereotype.rb
avm-tools-0.50.0 lib/eac_launcher/stereotype.rb
avm-tools-0.49.0 lib/eac_launcher/stereotype.rb
avm-tools-0.48.0 lib/eac_launcher/stereotype.rb
avm-tools-0.47.0 lib/eac_launcher/stereotype.rb
avm-tools-0.46.0 lib/eac_launcher/stereotype.rb
eac_launcher-0.8.0 lib/eac_launcher/stereotype.rb
eac_launcher-0.7.0 lib/eac_launcher/stereotype.rb
eac_launcher-0.6.8 lib/eac_launcher/stereotype.rb
eac_launcher-0.6.7 lib/eac_launcher/stereotype.rb