Class: XRT::Command::DumpBlocks

Inherits:
Object
  • Object
show all
Defined in:
lib/xrt/command/dump_blocks.rb

Instance Method Summary collapse

Instance Method Details

#dump_file(file) ⇒ Object



12
13
14
15
# File 'lib/xrt/command/dump_blocks.rb', line 12

def dump_file file
  blocks = find_blocks file
  puts blocks.join("\n=====\n")
end

#execute(files) ⇒ Object



6
7
8
9
10
# File 'lib/xrt/command/dump_blocks.rb', line 6

def execute(files)
  files.each{|file|
    puts dump_file file
  }
end

#find_blocks(file) ⇒ Object



17
18
19
# File 'lib/xrt/command/dump_blocks.rb', line 17

def find_blocks(file)
  XRT::Parser.new(open(file).read).document.find_blocks_with_directive.map{|s| s.auto_indent }
end