Class: Mulang::Language::External
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #ast(content, **args) ⇒ Object
- #base_analysis ⇒ Object
-
#initialize(language_name = nil, &tool) ⇒ External
constructor
A new instance of External.
- #sample(content) ⇒ Object
Methods inherited from Base
#ast_analysis, #identifiers, #identifiers_analysis, #normalization_options, #transformed_asts, #transformed_asts_analysis
Constructor Details
#initialize(language_name = nil, &tool) ⇒ External
Returns a new instance of External.
65 66 67 68 |
# File 'lib/mulang/language.rb', line 65 def initialize(language_name = nil, &tool) @name = language_name @tool = block_given? ? tool : proc { |it| it } end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
63 64 65 |
# File 'lib/mulang/language.rb', line 63 def name @name end |
Instance Method Details
#ast(content, **args) ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/mulang/language.rb', line 70 def ast(content, **args) if args[:serialization] super else call_tool content end end |
#base_analysis ⇒ Object
85 86 87 |
# File 'lib/mulang/language.rb', line 85 def base_analysis(*) super.deep_merge(spec: {originalLanguage: @name}.compact) end |
#sample(content) ⇒ Object
78 79 80 81 82 83 |
# File 'lib/mulang/language.rb', line 78 def sample(content) { tag: 'MulangSample', ast: call_tool(content) } end |