Sha256: 42083fc491634b051043b4e50d4f816bcee811429439f08ea5a38fa7f73fb60b

Contents?: true

Size: 1.89 KB

Versions: 19

Compression:

Stored size: 1.89 KB

Contents

module Jeanine
  class PathProxy
    def initialize(context, pathname, options = {})
      @context = context
      @pathname = pathname
      @options = options
    end

    def get(path = nil, options = {}, &block)
      @options.reverse_merge!(options)
      @context.get(merged_path(path), options, &block)
    end

    def post(path = nil, options = {}, &block)
      @options.reverse_merge!(options)
      @context.post(merged_path(path), options, &block)
    end

    def patch(path = nil, options = {}, &block)
      @options.reverse_merge!(options)
      @context.patch(merged_path(path), options, &block)
    end

    def put(path = nil, options = {}, &block)
      @options.reverse_merge!(options)
      @context.put(merged_path(path), options, &block)
    end

    def options(path = nil, options = {}, &block)
      @options.reverse_merge!(options)
      @context.options(merged_path(path), options, &block)
    end

    def head(path = nil, options = {}, &block)
      @options.reverse_merge!(options)
      @context.head(merged_path(path), options, &block)
    end

    def delete(path = nil, options = {}, &block)
      @options.reverse_merge!(options)
      @context.delete(merged_path(path), options, &block)
    end

    def path(path = nil, options = {}, &block)
      @options.reverse_merge!(options)
      @context.path(merged_path(path), options, &block)
    end

    def match(path = nil, options = {}, &block)
      @options.reverse_merge!(options)
      @context.match(merged_path(path), options, &block)
    end

    def root(path = '/', options = {}, &block)
      @options.reverse_merge!(options)
      @context.root(merged_path(path), options, &block)
    end

    def before(*paths, &block)
      @context.before(*paths, &block)
    end

    def after(*paths, &block)
      @context.after(*paths, &block)
    end

    private

    def merged_path(path)
      [@pathname, path].join
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
jeanine-0.8.1 lib/jeanine/path_proxy.rb
jeanine-0.8 lib/jeanine/path_proxy.rb
jeanine-0.7.8 lib/jeanine/path_proxy.rb
jeanine-0.7.7 lib/jeanine/path_proxy.rb
jeanine-0.7.6 lib/jeanine/path_proxy.rb
jeanine-0.7.5 lib/jeanine/path_proxy.rb
jeanine-0.7.4 lib/jeanine/path_proxy.rb
jeanine-0.7.3.2 lib/jeanine/path_proxy.rb
jeanine-0.7.3.1 lib/jeanine/path_proxy.rb
jeanine-0.7.3 lib/jeanine/path_proxy.rb
jeanine-0.7.2 lib/jeanine/path_proxy.rb
jeanine-0.7.1 lib/jeanine/path_proxy.rb
jeanine-0.7.0 lib/jeanine/path_proxy.rb
jeanine-0.6.0 lib/jeanine/path_proxy.rb
jeanine-0.5.0 lib/jeanine/path_proxy.rb
jeanine-0.4.0 lib/jeanine/path_proxy.rb
jeanine-0.3.0 lib/jeanine/path_proxy.rb
jeanine-0.2.0 lib/jeanine/path_proxy.rb
jeanine-0.1.0 lib/jeanine/path_proxy.rb