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.1.7 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.1.6 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.1.5 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.1.4 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.1.3 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.1.2 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.1.1 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.0.68 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.0.67 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.0.66 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.0.65 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.0.64 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.0.63 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.0.62 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.0.61 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.0.60 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.0.59 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.0.58 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.0.57 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.0.56 lib/eco/api/common/loaders/case_base.rb