Class: RubyCtagsSourceStructure
- Inherits:
-
CtagsSourceStructure
- Object
- SourceStructure
- CtagsSourceStructure
- RubyCtagsSourceStructure
- Defined in:
- ext/ae-editor/ae-editor.rb
Constant Summary
Constants inherited from CtagsSourceStructure
CtagsSourceStructure::SUPPORTED_LANG
Instance Attribute Summary collapse
-
#injected_row ⇒ Object
readonly
Returns the value of attribute injected_row.
Attributes inherited from SourceStructure
Instance Method Summary collapse
-
#initialize(_file, _ctags_string = 'ctags') ⇒ RubyCtagsSourceStructure
constructor
A new instance of RubyCtagsSourceStructure.
- #scheletor_from_node(_node, _source = '', _injected_source = '', _injected_class = '') ⇒ Object
Methods inherited from CtagsSourceStructure
Methods inherited from SourceStructure
#class_node_by_line, #deep_node_by_line, #node_by_line
Constructor Details
#initialize(_file, _ctags_string = 'ctags') ⇒ RubyCtagsSourceStructure
Returns a new instance of RubyCtagsSourceStructure.
175 176 177 |
# File 'ext/ae-editor/ae-editor.rb', line 175 def initialize(_file, ='ctags') super(_file, , 'Ruby') end |
Instance Attribute Details
#injected_row ⇒ Object (readonly)
Returns the value of attribute injected_row.
173 174 175 |
# File 'ext/ae-editor/ae-editor.rb', line 173 def injected_row @injected_row end |
Instance Method Details
#scheletor_from_node(_node, _source = '', _injected_source = '', _injected_class = '') ⇒ Object
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'ext/ae-editor/ae-editor.rb', line 179 def scheletor_from_node(_node, _source='', _injected_source='', _injected_class='') _hinner_source = '' #_sons = _node.sons.sort _sons = _node.sons for inode in 0.._sons.length - 1 _son = _sons[inode] if _son.kind == 'class' _hinner_source = "#{_hinner_source}#{_son.helptext}\n" elsif _son.kind == 'module' _hinner_source = "#{_hinner_source}#{_son.helptext}\n" elsif _son.kind == 'method' && _son.label != 'initialize' _hinner_source = "#{_hinner_source} def #{_son.label}\n" _hinner_source = "#{_hinner_source} end\n" elsif _son.kind == 'singleton method' _hinner_source = "#{_hinner_source} def #{_son.label}\n" _hinner_source = "#{_hinner_source} end\n" end _hinner_source= scheletor_from_node(_son, _hinner_source, _injected_source, _injected_class) end _source = "#{_source}#{_hinner_source}" if _hinner_source.strip.length>0 if _node.kind == 'class' && _node.label == _injected_class _source = "#{_source} def initialize\n #{_injected_source} end\n" @injected_row = _source.split("\n").length-2 end _source = "#{_source}end\n" if _node.kind == 'class' || _node.kind == 'module' _source end |