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', _row_rif = nil) ⇒ RubyCtagsSourceStructure
constructor
A new instance of RubyCtagsSourceStructure.
- #scheletor_from_node(_node, _source = '', _injected_source = '', _injected_class = '') ⇒ Object
Methods inherited from CtagsSourceStructure
#build_structure, #ctags, #initialize_blank_rows
Methods inherited from SourceStructure
#class_node_by_line, #deep_node_by_line, #node_by_line, root
Constructor Details
#initialize(_file, _ctags_string = 'ctags', _row_rif = nil) ⇒ RubyCtagsSourceStructure
Returns a new instance of RubyCtagsSourceStructure.
194 195 196 |
# File 'ext/ae-editor/ae-editor.rb', line 194 def initialize(_file, ='ctags', _row_rif = nil) super(_file, , _row_rif, 'Ruby') end |
Instance Attribute Details
#injected_row ⇒ Object (readonly)
Returns the value of attribute injected_row.
192 193 194 |
# File 'ext/ae-editor/ae-editor.rb', line 192 def injected_row @injected_row end |
Instance Method Details
#scheletor_from_node(_node, _source = '', _injected_source = '', _injected_class = '') ⇒ Object
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'ext/ae-editor/ae-editor.rb', line 198 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') || (_son.label == 'initialize') && _son.args) _hinner_source = "#{_hinner_source} def #{_son.label}#{_son.args}\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 elsif _node.kind == 'class' _source = "#{_source} def initialize\n end\n" end _source = "#{_source}end\n" if _node.kind == 'class' || _node.kind == 'module' _source end |