Sha256: dfdee3a74d248b1b03f71d5f14dafcd74ab8b38aa77fb49ed94749cdb7678672

Contents?: true

Size: 696 Bytes

Versions: 23

Compression:

Stored size: 696 Bytes

Contents

# frozen-string-literal: true

module Rodauth
  Feature.define(:path_class_methods, :PathClassMethods) do
    def post_configure
      super

      klass = self.class
      klass.features.each do |feature_name|
        feature = FEATURES[feature_name]
        feature.routes.each do |handle_meth|
          route = handle_meth.to_s.sub(/\Ahandle_/, '')
          path_meth = :"#{route}_path"
          url_meth = :"#{route}_url"
          instance = klass.allocate.freeze
          klass.define_singleton_method(path_meth){|opts={}| instance.send(path_meth, opts)}
          klass.define_singleton_method(url_meth){|opts={}| instance.send(url_meth, opts)}
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rodauth-2.37.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.36.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.34.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.33.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.32.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.31.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.30.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.29.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.28.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.27.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.26.1 lib/rodauth/features/path_class_methods.rb
rodauth-2.26.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.25.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.24.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.23.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.22.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.21.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.20.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.19.0 lib/rodauth/features/path_class_methods.rb
rodauth-2.18.0 lib/rodauth/features/path_class_methods.rb