Class: CPEE::Frames::SetLang
- Inherits:
-
Riddl::Implementation
- Object
- Riddl::Implementation
- CPEE::Frames::SetLang
- Defined in:
- lib/cpee-frames/implementation.rb
Overview
}}}
Instance Method Summary collapse
-
#response ⇒ Object
{{{.
Instance Method Details
#response ⇒ Object
{{{
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/cpee-frames/implementation.rb', line 344 def response data_dir = @a[1] fname = File.join(data_dir,@r[-2],'info.json') if File.exist? fname infojson = JSON::parse(File.read(fname)) infojson["lang"] = @p[0].value #add to langs if !infojson["langs"].include?(@p[0].value) infojson["langs"].push(@p[0].value) end File.write(fname, JSON.dump(infojson)) @a[0].send(JSON.dump({ message: 'reset' })) nil else @status = 404 end end |