lib/gzr/commands/model/ls.rb in gazer-0.3.10 vs lib/gzr/commands/model/ls.rb in gazer-0.3.11

- old
+ new

@@ -1,8 +1,8 @@ # The MIT License (MIT) -# Copyright (c) 2018 Mike DeAngelo Looker Data Sciences, Inc. +# Copyright (c) 2023 Mike DeAngelo Google, Inc. # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of @@ -36,22 +36,22 @@ end def execute(input: $stdin, output: $stdout) say_warning(@options) if @options[:debug] with_session do - data = query_all_lookml_models(@options[:fields]) + data = query_all_lookml_models(@options[:fields], @options[:debug]) begin say_ok "No users found" return nil end unless data && data.length > 0 table_hash = Hash.new fields = field_names(@options[:fields]) table_hash[:header] = fields unless @options[:plain] - expressions = fields.collect { |fn| field_expression(fn) } + expressions = fields.collect { |fn| field_expression_hash(fn) } table_hash[:rows] = data.map do |row| expressions.collect do |e| - eval "row.#{e}" + eval "row#{e}" end end table = TTY::Table.new(table_hash) alignments = fields.collect do |k| (k =~ /id$/) ? :right : :left