Sha256: 7f1670d6471af85727bb3f3608185b40325f4cebdd8c9433fde0b2846c47323b

Contents?: true

Size: 831 Bytes

Versions: 7

Compression:

Stored size: 831 Bytes

Contents

# frozen_string_literal: true

require "pakyow/support/extension"

require "pakyow/endpoints"

module Pakyow
  class Application
    module Behavior
      module Endpoints
        extend Support::Extension

        apply_extension do
          after "initialize" do
            load_endpoints
          end
        end

        prepend_methods do
          def initialize(*)
            @endpoints = ::Pakyow::Endpoints.new

            super
          end
        end

        # Instance of {Endpoints} for path building.
        #
        attr_reader :endpoints

        private

        def load_endpoints
          state.values.each do |state_object|
            state_object.instances.each do |state_instance|
              @endpoints.load(state_instance)
            end
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pakyow-core-1.0.6 lib/pakyow/application/behavior/endpoints.rb
pakyow-core-1.0.5 lib/pakyow/application/behavior/endpoints.rb
pakyow-core-1.0.4 lib/pakyow/application/behavior/endpoints.rb
pakyow-core-1.0.3 lib/pakyow/application/behavior/endpoints.rb
pakyow-core-1.0.2 lib/pakyow/application/behavior/endpoints.rb
pakyow-core-1.0.1 lib/pakyow/application/behavior/endpoints.rb
pakyow-core-1.0.0 lib/pakyow/application/behavior/endpoints.rb