Method: SWS::ComponentCache#component
- Defined in:
- lib/sws/session.rb
#component(component_id) ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/sws/session.rb', line 148 def component ( component_id ) if( component_id == @components.last.object_id ) return @components.last else component = @components.find { |c| c.object_id == component_id } end unless component return nil else # Old behaviour (for optimalization) # Remove all components that are after found component - they are in the # "branch" the client shouldn't have access to. Of course they are added # to @old_component_ids for the case user backtracks to them. # # Accidentally, this works correctly even if component == # @components.last (that means there was no backtracking) - that is, it # doesn't remove anything. # #@old_component_ids.concat( # @components.slice!( @components.index( component ) + 1 .. -1 ).collect { |com| com.object_id } #) # @components.push( @components.delete( component ) ) # puts @components.each { |c| print "-- ", c.object_id, "\n" } # puts component_id return component end end |