module Ruby2JS::SprocketsTransformer
Constants
- VERSION
Public Class Methods
cache_key()
click to toggle source
# File lib/ruby2js/sprockets.rb, line 17 def self.cache_key @cache_key ||= "#{name}:#{Ruby2JS::VERSION::STRING}:#{VERSION}".freeze end
call(input)
click to toggle source
# File lib/ruby2js/sprockets.rb, line 21 def self.call(input) data = input[:data] js, map = input[:cache].fetch([self.cache_key, data]) do result = Ruby2JS.convert(data, {**@@options, file: input[:filename]}) [result.to_s, result.sourcemap.transform_keys {|key| key.to_s}] end map = SourceMapUtils.format_source_map(map, input) map = SourceMapUtils.combine_source_maps(input[:metadata][:map], map) { data: js, map: map } end
options=(options)
click to toggle source
# File lib/ruby2js/sprockets.rb, line 13 def self.options=(options) @@options = options end