Skip to content

Commit

Permalink
Code style
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Oct 17, 2024
1 parent 39b3710 commit a93ed39
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/sassc/embedded.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,14 @@ class FunctionsHandler
remove_method(:setup) if public_method_defined?(:setup, false)

def setup(_native_options, functions: Script::Functions)
@callbacks = {}

functions_wrapper = Class.new do
attr_accessor :options

include functions
end.new
functions_wrapper.options = @options

Script.custom_functions(functions:).each do |custom_function|
Script.custom_functions(functions:).each_with_object({}) do |custom_function, callbacks|
callback = lambda do |native_argument_list|
function_arguments = arguments_from_native_list(native_argument_list)
begin
Expand All @@ -162,10 +160,8 @@ def setup(_native_options, functions: Script::Functions)
raise e
end

@callbacks[Script.formatted_function_name(custom_function, functions:)] = callback
callbacks[Script.formatted_function_name(custom_function, functions:)] = callback
end

@callbacks
end

private
Expand Down Expand Up @@ -375,8 +371,7 @@ def import_to_native(import, parent_dir, from_import, canonicalize)
canonical_url = Uri.path_to_file_url(File.absolute_path(import.path, parent_dir))
@importer_results[canonical_url] = if import.source.is_a?(Hash)
{
contents: import.source[:contents],
syntax: import.source[:syntax],
**import.source,
source_map_url: canonical_url
}
else
Expand Down

0 comments on commit a93ed39

Please sign in to comment.