Class: Klenod::Build::Plugins::CSSPlugin::TransformResult
- Inherits:
-
Data
- Object
- Data
- Klenod::Build::Plugins::CSSPlugin::TransformResult
- Defined in:
- lib/klenod/plugin/css/transformer.rb
Instance Attribute Summary collapse
-
#classes ⇒ Object
readonly
Returns the value of attribute classes.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
-
#elements ⇒ Object
readonly
Returns the value of attribute elements.
-
#exports ⇒ Object
readonly
Returns the value of attribute exports.
-
#references ⇒ Object
readonly
Returns the value of attribute references.
-
#serialized_variables ⇒ Object
readonly
Returns the value of attribute serialized_variables.
-
#source_map ⇒ Object
readonly
Returns the value of attribute source_map.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Class Method Summary collapse
- .dependency_from_ext(dep) ⇒ Object
- .export_from_ext(export) ⇒ Object
- .from_ext(data) ⇒ Object
- .reference_from_ext(reference) ⇒ Object
Instance Attribute Details
#classes ⇒ Object (readonly)
Returns the value of attribute classes
40 41 42 |
# File 'lib/klenod/plugin/css/transformer.rb', line 40 def classes @classes end |
#code ⇒ Object (readonly)
Returns the value of attribute code
40 41 42 |
# File 'lib/klenod/plugin/css/transformer.rb', line 40 def code @code end |
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies
40 41 42 |
# File 'lib/klenod/plugin/css/transformer.rb', line 40 def dependencies @dependencies end |
#elements ⇒ Object (readonly)
Returns the value of attribute elements
40 41 42 |
# File 'lib/klenod/plugin/css/transformer.rb', line 40 def elements @elements end |
#exports ⇒ Object (readonly)
Returns the value of attribute exports
40 41 42 |
# File 'lib/klenod/plugin/css/transformer.rb', line 40 def exports @exports end |
#references ⇒ Object (readonly)
Returns the value of attribute references
40 41 42 |
# File 'lib/klenod/plugin/css/transformer.rb', line 40 def references @references end |
#serialized_variables ⇒ Object (readonly)
Returns the value of attribute serialized_variables
40 41 42 |
# File 'lib/klenod/plugin/css/transformer.rb', line 40 def serialized_variables @serialized_variables end |
#source_map ⇒ Object (readonly)
Returns the value of attribute source_map
40 41 42 |
# File 'lib/klenod/plugin/css/transformer.rb', line 40 def source_map @source_map end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables
40 41 42 |
# File 'lib/klenod/plugin/css/transformer.rb', line 40 def variables @variables end |
Class Method Details
.dependency_from_ext(dep) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/klenod/plugin/css/transformer.rb', line 54 def self.dependency_from_ext(dep) case dep.fetch("type") when "import" ImportDependency[ url: dep.fetch("url"), placeholder: dep.fetch("placeholder"), supports: dep.fetch("supports"), media: dep.fetch("media"), loc: Loc.from_ext(dep.fetch("loc")) ] when "url" UrlDependency[ url: dep.fetch("url"), placeholder: dep.fetch("placeholder"), loc: Loc.from_ext(dep.fetch("loc")) ] end end |
.export_from_ext(export) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/klenod/plugin/css/transformer.rb', line 73 def self.export_from_ext(export) Export[ name: export.fetch("name"), referenced?: export.fetch("isReferenced"), composes: export.fetch("composes").map do |compose| case compose.fetch("type") when "local" ComposeLocal[name: compose.fetch("name").to_sym] when "global" ComposeGlobal[name: compose.fetch("name")] when "dependency" ComposeDependency[name: compose.fetch("name").to_sym, specifier: compose.fetch("specifier")] end end ] end |
.from_ext(data) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/klenod/plugin/css/transformer.rb', line 41 def self.from_ext(data) = new( classes: data.fetch("classes").transform_keys(&:to_sym), elements: data.fetch("elements").transform_keys(&:to_sym), variables: data.fetch("variables"), serialized_variables: data.fetch("serialized_variables"), code: data.fetch("code"), source_map: data.fetch("source_map"), dependencies: JSON.parse(data.fetch("dependencies")).map { dependency_from_ext(it) }, exports: JSON.parse(data.fetch("exports")).transform_values { export_from_ext(it) }, references: JSON.parse(data.fetch("references")).transform_values { reference_from_ext(it) } ) |
.reference_from_ext(reference) ⇒ Object
90 91 92 93 94 95 96 97 98 |
# File 'lib/klenod/plugin/css/transformer.rb', line 90 def self.reference_from_ext(reference) case reference.fetch("type") when "dependency" VariableDependency[ name: reference.fetch("name"), specifier: reference.fetch("specifier") ] end end |