Sha256: a036ad02a4edaca298e1d0cdb96c9fbaf8137468cc25a7fe0d33749f38f35f7b

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 Bytes

Contents

module EacLauncher
  module Stereotype
    class << self
      attr_reader :stereotypes

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

      def nogit_stereotypes
        stereotypes.reject { |c| c.name.demodulize.downcase.match('git') }
      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 transpose_class
        sub_class('Transpose')
      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

1 entries across 1 versions & 1 rubygems

Version Path
eac_launcher-0.1.0 lib/eac_launcher/stereotype.rb