Class: Mulang::Language::Base
- Inherits:
-
Object
- Object
- Mulang::Language::Base
- Defined in:
- lib/mulang/language.rb
Instance Method Summary collapse
- #ast(content, **options) ⇒ Object
- #ast_analysis(content, **options) ⇒ Object
- #build_analysis(content, spec, **options) ⇒ Object
- #identifiers(content, **options) ⇒ Object
- #identifiers_analysis(content, **options) ⇒ Object
- #normalization_options(**options) ⇒ Object
- #transformed_asts(content, operations, **options) ⇒ Object
- #transformed_asts_analysis(content, operations, **options) ⇒ Object
Instance Method Details
#ast(content, **options) ⇒ Object
37 38 39 |
# File 'lib/mulang/language.rb', line 37 def ast(content, **) Mulang.analyse(ast_analysis(content, **), **)['outputAst'] rescue nil end |
#ast_analysis(content, **options) ⇒ Object
41 42 43 |
# File 'lib/mulang/language.rb', line 41 def ast_analysis(content, **) build_analysis content, {includeOutputAst: true}, ** end |
#build_analysis(content, spec, **options) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/mulang/language.rb', line 45 def build_analysis(content, spec, **) { sample: sample(content), spec: { expectations: [], smellsSet: { tag: 'NoSmells' }, includeOutputAst: false, normalizationOptions: (**) }.merge(spec).compact } end |
#identifiers(content, **options) ⇒ Object
17 18 19 |
# File 'lib/mulang/language.rb', line 17 def identifiers(content, **) Mulang.analyse(identifiers_analysis(content, **), **)['outputIdentifiers'] rescue nil end |
#identifiers_analysis(content, **options) ⇒ Object
21 22 23 |
# File 'lib/mulang/language.rb', line 21 def identifiers_analysis(content, **) build_analysis content, {includeOutputIdentifiers: true}, ** end |
#normalization_options(**options) ⇒ Object
33 34 35 |
# File 'lib/mulang/language.rb', line 33 def (**) .except(:serialization).presence end |
#transformed_asts(content, operations, **options) ⇒ Object
25 26 27 |
# File 'lib/mulang/language.rb', line 25 def transformed_asts(content, operations, **) Mulang.analyse(transformed_asts_analysis(content, operations, **), **)['transformedAsts'] rescue nil end |
#transformed_asts_analysis(content, operations, **options) ⇒ Object
29 30 31 |
# File 'lib/mulang/language.rb', line 29 def transformed_asts_analysis(content, operations, **) build_analysis content, {transformationSpecs: operations}, ** end |