Sha256: be26395ac9ecb871ba18f4938d99c76b664714fd488db67155004cbe9d2d3abd

Contents?: true

Size: 809 Bytes

Versions: 70

Compression:

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

          def name
            self.class.name
          end

        end
      end
    end
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
eco-helpers-2.4.9 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.4.8 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.4.7 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.4.6 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.4.5 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.4.4 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.4.3 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.4.2 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.3.3 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.3.2 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.2.5 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.2.4 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.2.3 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.2.2 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.2.1 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.1.12 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.1.11 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.1.10 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.1.9 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.1.8 lib/eco/api/common/loaders/case_base.rb