Sha256: 29832f5d4c51cc0ed8e8875859b8dea9b5fbec8e94c4ef3af9f1f02835ebf7c5
Contents?: true
Size: 787 Bytes
Versions: 4
Compression:
Stored size: 787 Bytes
Contents
module Vedeu class MenuParser def self.parse(menu) new(menu).parse end def initialize(menu) @menu = menu end def parse { interfaces: interface } end private attr_reader :menu def interface { name: name, lines: lines } end def lines lines = [] items.each do |sel, cur, item| if sel && cur lines << { streams: { text: "*> #{item}" } } elsif cur lines << { streams: { text: " > #{item}" } } elsif sel lines << { streams: { text: "* #{item}" } } else lines << { streams: { text: " #{item}" } } end end lines end def items menu.last end def name menu.first end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.1.4 | lib/vedeu/output/menu_parser.rb |
vedeu-0.1.3 | lib/vedeu/output/menu_parser.rb |
vedeu-0.1.2 | lib/vedeu/output/menu_parser.rb |
vedeu-0.1.1 | lib/vedeu/parsing/menu_parser.rb |