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
{{{
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/cpee-frames/implementation.rb', line 328 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('reset') nil else @status = 404 end end |