lib/st_html/ruing/elements/default_item.rb
# Copy contructor
#
# Subclasses must call the method passing the block where the *correct* 
# *type* is initialized, then here we can set the common data and at the end
# when this method exits the subclass may proceed with more specific copying
# activities.
# 
Copy contructor
Subclasses must call the method passing the block where the *correct
type* is initialized, then here we can set the common data and at the end
when this method exits the subclass may proceed with more specific copying
activities.
Copy contructor Subclasses must call the method passing the block where the * correct type * is initialized then here we can set the common data and at the end when this method exits the subclass may proceed with more specific copying activities .
def copy
        rv = unless block_given? 
            DefaultItem.new "copy_of_#{self.name}", \
                    self.options.merge( \
                        :renderer_options => @renderer.options, \
                        :serializer_options => @serializer.options,
                        :session => @session
                    ) 
        else
            yield(self.options) || nil
        end
        unless rv.nil?
            rv.name= "copy_of_#{self.name}" unless rv.name 
            rv.value= self.value unless rv.value 
            rv.validators= @validators.map { |x| x.copy } unless rv.validators.size > 0 
            rv.renderer= @renderer.copy unless @renderer.nil? || rv.renderer 
            rv.serializer= @serializer.copy unless @serializer.nil? || rv.serializer
            rv.editor= @editor.copy unless @editor.nil? || rv.editor
            rv.session= @session unless @session.nil? || rv.session
        end
        rv
    end
def copy rv = unless block_given? DefaultItem . new "copy_of_#{self.name}" , self . options . merge ( :renderer_options => @renderer . options , :serializer_options => @serializer . options , :session => @session ) else yield ( self . options ) || nil end unless rv . nil? rv . name = "copy_of_#{self.name}" unless rv . name rv . value = self . value unless rv . value rv . validators = @validators . map { | x | x . copy } unless rv . validators . size > 0 rv . renderer = @renderer . copy unless @renderer . nil? || rv . renderer rv . serializer = @serializer . copy unless @serializer . nil? || rv . serializer rv . editor = @editor . copy unless @editor . nil? || rv . editor rv . session = @session unless @session . nil? || rv . session end rv end
Copy contructor
Subclasses must call the method passing the block where the *correct
type* is initialized, then here we can set the common data and at the end
when this method exits the subclass may proceed with more specific copying
activities.
Copy contructor Subclasses must call the method passing the block where the * correct type * is initialized then here we can set the common data and at the end when this method exits the subclass may proceed with more specific copying activities .
# If yield branch don't set up common things we do it here