class CPEE::ModelManagement::GetListFull
Public Instance Methods
response()
click to toggle source
# File lib/cpee-model-management/implementation.rb, line 201 def response views = @a[0] models = @a[1] stage = [@p[0]&.value] || ['draft'] stage << views[stage[0]] if views && views[stage[0]] names = Dir.glob(File.join(models,'*.dir/*.xml')).map do |f| attrs = JSON::load File.open(f + '.attrs') { :type => :file, :name => File.join(File.basename(File.dirname(f)),File.basename(f)), :creator => attrs['creator'], :date => File.mtime(f).xmlschema } end.compact.uniq.sort_by{ |e| e[:name] } + Dir.glob(File.join(models,'*.xml')).map do |f| attrs = JSON::load File.open(f + '.attrs') fstage = attrs['design_stage'] rescue 'draft' { :type => :file, :name => File.basename(f), :creator => attrs['creator'], :author => attrs['author'], :guarded => attrs['guarded'], :guarded_id => attrs['guarded_id'], :stage => fstage, :date => File.mtime(f).xmlschema } if stage.include?(fstage) end.compact.uniq.sort_by{ |e| e[:name] } Riddl::Parameter::Complex.new('list','application/json',JSON::pretty_generate(names)) end