Skip to content

Commit

Permalink
Don't use pattern matching
Browse files Browse the repository at this point in the history
tapioca uses YARD for parsing, and YARD is currently unable to parse these
expressions, so I couldn't generate RBI files for sorbet using tapioca.

lsegal/yard#1521
  • Loading branch information
aalin committed Jan 10, 2024
1 parent 0684b71 commit 7b3d265
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions lib/mayu/css.rb
Expand Up @@ -60,12 +60,10 @@ def self.from_ext(data) =
.then { JSON.parse(_1, symbolize_names: true) }
.transform_keys(&:to_s)
.transform_values do |export|
export => { name:, composes:, isReferenced: }

Export[
name:,
referenced?: isReferenced,
composes: composes.map do |compose|
name: export[:name],
referenced?: export[:isReferenced],
composes: export[:composes].map do |compose|
case compose
in { type: "local", name: }
ComposeLocal[name:]
Expand Down Expand Up @@ -93,13 +91,13 @@ def code_with_source_map

SerializeResult = Data.define(:rules, :sources, :source_map_urls, :license_comments) do
def self.from_ext(data)
JSON.parse(data, symbolize_names: true) => {
rules:,
sources:,
sourceMapUrls: source_map_urls,
licenseComments: license_comments,
}
new(rules:, sources:, source_map_urls:, license_comments:)
parsed = JSON.parse(data, symbolize_names: true)
new(
rules: parsed[:rules],
sources: parsed[:sources],
source_map_urls: parsed[:sourceMapUrls],
license_comments: parsed[:licenseComments]
)
end
end

Expand Down

0 comments on commit 7b3d265

Please sign in to comment.