class Envo::PathListVal
Public Class Methods
new(host, ar)
click to toggle source
Calls superclass method
Envo::ListVal::new
# File lib/envo/val/path_list_val.rb, line 3 def initialize(host, ar) super(ar) @host = host end
Public Instance Methods
accept_assign?(other)
click to toggle source
# File lib/envo/val/path_list_val.rb, line 10 def accept_assign?(other) other.type == type end
accept_item?(item)
click to toggle source
# File lib/envo/val/path_list_val.rb, line 13 def accept_item?(item) item.type == :path end
clean!()
click to toggle source
# File lib/envo/val/path_list_val.rb, line 45 def clean! helper = make_helper_map helper.select! { |e| e[:id] != -1 } helper.uniq! { |e| e[:id] } @ar = helper.map { |e| e[:str] } end
make_helper_map()
click to toggle source
# File lib/envo/val/path_list_val.rb, line 17 def make_helper_map @ar.map { |p| id = @host.path_id(p) { str: p, id: id } } end
pretty_print(ctx)
click to toggle source
# File lib/envo/val/path_list_val.rb, line 24 def pretty_print(ctx) helper = make_helper_map ctx.puts "[" helper.each_with_index do |v, i| dupes = helper.count { |e| if e[:str] == v[:str] then true elsif e[:id] == -1 then false else e[:id] == v[:id] end } str = dupes > 1 ? 'D' : ' ' str += v[:id] != -1 ? ' ' : 'N' str += ' ' str += "#{i}:".ljust(4) str += v[:str] ctx.puts str end ctx.puts ']' end
type()
click to toggle source
# File lib/envo/val/path_list_val.rb, line 7 def type :"path list" end