Sha256: 196e9a4d81236daddf4a1d9a21240059f9a6a4d13cfd5e1e55ffbd666781aa4a
Contents?: true
Size: 943 Bytes
Versions: 3
Compression:
Stored size: 943 Bytes
Contents
module Vedeu class MenuParser # Convert a Vedeu::Menu into an interface view. # # @param output [Hash] a key/value pair. # # @return [Hash] def self.parse(output = {}) new(output).parse end def initialize(output = {}) @output = output end def parse { interfaces: interface } end private attr_reader :output 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 output.last end def name output.first end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.1.0 | lib/vedeu/parsing/menu_parser.rb |
vedeu-0.0.42 | lib/vedeu/parsing/menu_parser.rb |
vedeu-0.0.41 | lib/vedeu/parsing/menu_parser.rb |