Class: DevScripts::Support::FlattenedMethod
- Inherits:
-
ExpandedMethod
- Object
- String
- ExpandedMethod
- DevScripts::Support::FlattenedMethod
- Defined in:
- lib/dev_scripts/support/expanded_method.rb
Constant Summary
Constants inherited from ExpandedMethod
Instance Method Summary collapse
-
#initialize(ast_node:) ⇒ FlattenedMethod
constructor
A new instance of FlattenedMethod.
Constructor Details
#initialize(ast_node:) ⇒ FlattenedMethod
Returns a new instance of FlattenedMethod.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/dev_scripts/support/expanded_method.rb', line 96 def initialize(ast_node:) @type = ast_node.type @children = ast_node.children raise NotAMethodError unless [:send, :block].include?(type) get_components self << string_receiver args.each_with_index do |arg, index| if index == 0 self << '(' end self << string_arg(arg) self << "," unless index == args.length - 1 self << ")" if index == args.length - 1 end case type when :block self << ' { ' self << string_block_body self << ' }' end end |