Class: Proscenium::Middleware::RubyGems

Inherits:
Esbuild show all
Defined in:
lib/proscenium/middleware/ruby_gems.rb

Instance Method Summary collapse

Methods inherited from Esbuild

#attempt

Methods inherited from Base

attempt, #initialize, #renderable!

Constructor Details

This class inherits a constructor from Proscenium::Middleware::Base

Instance Method Details

#gem_nameObject



14
15
16
# File 'lib/proscenium/middleware/ruby_gems.rb', line 14

def gem_name
  @gem_name ||= gem_request_path.split('/').first
end

#gem_request_pathObject



18
19
20
# File 'lib/proscenium/middleware/ruby_gems.rb', line 18

def gem_request_path
  @gem_request_path ||= @request.path.delete_prefix('/node_modules/@rubygems/')
end

#real_pathObject



6
7
8
# File 'lib/proscenium/middleware/ruby_gems.rb', line 6

def real_path
  @real_path ||= Pathname.new(gem_request_path.delete_prefix("#{gem_name}/")).to_s
end

#root_for_readableObject



10
11
12
# File 'lib/proscenium/middleware/ruby_gems.rb', line 10

def root_for_readable
  BundledGems.pathname_for!(gem_name)
end