Sha256: c92de3d0ed8e9add0be9134bd706d03cfb14565d948b6ad7f4ce2d81fe3f959b

Contents?: true

Size: 720 Bytes

Versions: 5

Compression:

Stored size: 720 Bytes

Contents

module UniverseCompiler
  module Entity

    module AutoNamed

      attr_reader :auto_named_entity_type_seed

      def auto_named_entity_type(seed = nil)
        @auto_named_entity_type = true
        @auto_named_entity_type_seed = if seed.nil?
                                         entity_type.to_s
                                       else
                                         seed
                                       end
        @entity_type_counter = 0
      end

      def auto_named_entity_type?
        @auto_named_entity_type
      end

      def get_unique_name
        @entity_type_counter += 1
        '%s_%u' % [auto_named_entity_type_seed, @entity_type_counter]
      end

    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
universe_compiler-0.2.15 lib/universe_compiler/entity/auto_named.rb
universe_compiler-0.2.14 lib/universe_compiler/entity/auto_named.rb
universe_compiler-0.2.13 lib/universe_compiler/entity/auto_named.rb
universe_compiler-0.2.12 lib/universe_compiler/entity/auto_named.rb
universe_compiler-0.2.11 lib/universe_compiler/entity/auto_named.rb