Sha256: e68f4f69c05d23f7ef80aa88b09439db3928749f9ffa460d29afaff9b6cbe81f

Contents?: true

Size: 798 Bytes

Versions: 40

Compression:

Stored size: 798 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 ||= 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

40 entries across 40 versions & 1 rubygems

Version Path
eco-helpers-3.0.1 lib/eco/api/common/loaders/case_base.rb
eco-helpers-3.0.0 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.25 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.24 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.23 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.22 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.21 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.20 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.19 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.18 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.17 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.16 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.15 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.14 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.13 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.12 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.4 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.2 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.1 lib/eco/api/common/loaders/case_base.rb
eco-helpers-2.7.0 lib/eco/api/common/loaders/case_base.rb