Class: Mulang::Language::Native
- Inherits:
-
Object
- Object
- Mulang::Language::Native
- Defined in:
- lib/mulang/language.rb
Instance Method Summary collapse
- #ast(content) ⇒ Object
- #ast_analysis(content) ⇒ Object
-
#initialize(language) ⇒ Native
constructor
A new instance of Native.
- #sample(content) ⇒ Object
Constructor Details
#initialize(language) ⇒ Native
Returns a new instance of Native.
3 4 5 |
# File 'lib/mulang/language.rb', line 3 def initialize(language) @language = language end |
Instance Method Details
#ast(content) ⇒ Object
7 8 9 |
# File 'lib/mulang/language.rb', line 7 def ast(content) Mulang.analyse(ast_analysis(content))['intermediateLanguage'] rescue nil end |
#ast_analysis(content) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/mulang/language.rb', line 11 def ast_analysis(content) { sample: { tag: 'CodeSample', language: @language, content: content }, spec: { expectations: [], smellsSet: { tag: 'NoSmells' }, includeIntermediateLanguage: true } } end |
#sample(content) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/mulang/language.rb', line 18 def sample(content) { tag: 'CodeSample', language: @language, content: content } end |