Sha256: 61efe41fadc5b0706d96d619887b58dd26d6f33a99193a7ccff4b8c93f31ed4f

Contents?: true

Size: 831 Bytes

Versions: 9

Compression:

Stored size: 831 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 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

9 entries across 9 versions & 1 rubygems

Version Path
eac_launcher-0.2.1 lib/eac_launcher/stereotype.rb
eac_launcher-0.2.0 lib/eac_launcher/stereotype.rb
eac_launcher-0.1.7 lib/eac_launcher/stereotype.rb
eac_launcher-0.1.6 lib/eac_launcher/stereotype.rb
eac_launcher-0.1.5 lib/eac_launcher/stereotype.rb
eac_launcher-0.1.3 lib/eac_launcher/stereotype.rb
eac_launcher-0.1.4 lib/eac_launcher/stereotype.rb
eac_launcher-0.1.2 lib/eac_launcher/stereotype.rb
eac_launcher-0.1.1 lib/eac_launcher/stereotype.rb