Class: DevScripts::Support::ExpandedBlock
- Inherits:
-
String
- Object
- String
- DevScripts::Support::ExpandedBlock
- Defined in:
- lib/dev_scripts/support/expanded_block.rb
Instance Method Summary collapse
-
#initialize(line:) ⇒ ExpandedBlock
constructor
A new instance of ExpandedBlock.
Constructor Details
#initialize(line:) ⇒ ExpandedBlock
Returns a new instance of ExpandedBlock.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/dev_scripts/support/expanded_block.rb', line 8 def initialize(line:) parsed = Parser::CurrentRuby.parse(line).children spacing = line.match(/\A\s*/)[0] end_spacing = line.match(/\s*\z/)[0] block_string = DevScripts::Support::Block.new(parsed[1], parsed[2]) block_lines = block_string.split("\n") self << spacing + DevScripts::Support::MethodCall.new(parsed[0]) self << ' ' self << block_lines[0] self << "\n" self << spacing + block_lines[1] self << "\n" self << spacing + block_lines[2] self << end_spacing end |