Sha256: ec5b079e321b22d6d2d23b6bf98df86a2527245a130fb991185bf8666d1adbcf

Contents?: true

Size: 837 Bytes

Versions: 11

Compression:

Stored size: 837 Bytes

Contents

module Eco
  module API
    module Common
      module Loaders
        class CaseBase < Loaders::Base
          class << self
            attr_writer :name, :type

            # The name that this case, policy or error handler will have.
            def name(value = nil)
              name_only_once! if value
              set_created_at!
              return @name ||= self.to_s unless value
              @name = value
            end

            # Prevent the same class to be re-opened/re-named
            def name_only_once!
              raise "You have already declared #{self} or you are trying to give it a name twice" if @name
            end
          end

          attr_reader :usecase

          def name
            self.class.name
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
eco-helpers-2.6.0 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.5.10 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.5.9 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.5.8 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.5.7 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.5.6 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.5.5 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.5.4 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.5.3 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.5.2 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.5.1 lib/eco/api/common/loaders/case_base.rb