Class: PlcUtil::AwlPrettyPrintRunner
- Inherits:
-
Clamp::Command
- Object
- Clamp::Command
- PlcUtil::AwlPrettyPrintRunner
- Defined in:
- lib/plcutil/siemens/awl_pretty_print_runner.rb
Overview
Command line tool to read and output an awl file
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/plcutil/siemens/awl_pretty_print_runner.rb', line 10 def execute opt = { :symlist => symlist, :blocks => Hash[block_name.split(/[,=]/)] } file_list.each do |filename| process_awl_file Awl::AwlFile.new(filename, opt) end end |
#fix_name(name) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/plcutil/siemens/awl_pretty_print_runner.rb', line 21 def fix_name(name) if no_block? name.sub /^[^\.]*\./, '' else name end end |
#process_awl_file(awl) ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/plcutil/siemens/awl_pretty_print_runner.rb', line 29 def process_awl_file(awl) awl.each_exploded do |addr, name, comment, type_name| puts '%-11s %-40s%-10s%s' % [ addr.to_s, fix_name(name), type_name.to_s.upcase, comment ] end end |