Class: CPEE::Properties::PutPositions
- Inherits:
-
Riddl::Implementation
- Object
- Riddl::Implementation
- CPEE::Properties::PutPositions
- Defined in:
- lib/cpee/implementation_properties.rb
Overview
}}}
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.set(id, opts, xml) ⇒ Object
{{{
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 |
# File 'lib/cpee/implementation_properties.rb', line 587 def PutPositions::set(id,opts,xml) doc = XML::Smart::string(xml) content = {} newkeys = [] doc.find("/*/*").map do |ele| val = { 'position' => ele.qname.name } val['passthrough'] = ele.attributes['passthrough'] if ele.attributes['passthrough'] content[ele.text] ||= [] content[ele.text] << val newkeys << ele.qname.name end oldkeys = CPEE::Persistence::extract_set(id,opts,'positions').to_h.keys del = oldkeys - newkeys del.each do |key| val = { 'position' => key } content['unmark'] ||= [] content['unmark'] << val end CPEE::Persistence::set_item(id,opts,'position',content) end |
Instance Method Details
#response ⇒ Object
608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 |
# File 'lib/cpee/implementation_properties.rb', line 608 def response id = @a[0] opts = @a[1] if opts[:statemachine].readonly? id @status = 423 elsif opts[:statemachine].final? id @status = 410 else begin PutPositions::set(id,opts,@p[0].value.read) rescue => e @status = 400 end end nil end |