C0 code coverage information

Generated on Tue Jun 09 17:50:06 +0900 2009 with rcov 0.8.1.2


Code reported as executed by Ruby looks like
    this... and this: this line is also marked as
    covered. Lines considered as run by rcov, but
    not reported by Ruby, look like this, and
    this: these lines were inferred by rcov (using simple heuristics).
    Finally, here's a line marked as not
    executed. 
Name Total lines Lines of code Total coverage Code coverage
lib/nested_ajax/pane/has_many_pane.rb 93 83
100.0%  
100.0%  
 1 #
    -*- coding: utf-8 -*-  2
    require 'nested_ajax/pane'  3  4
    module NestedAjax  5 module
    Pane  6 class HasManyPane
    < AssociationPane  7
    attr_accessor :child_index  8  9 def
    initialize(template, form_or_object, association_name, options = {})
    10 super(template,
    form_or_object, association_name, options) 11 unless @reflection.macro == :has_many 12 raise ArgumentError,
    "#{association_name} of #{object.class.name} is not defined with
    has_many but #{@reflection.macro}" 13 end 14 @child_index = options[:child_index] ||
    @associated_object.size 15 end 16 17
    def each(options = nil, &block) 18 @associated_object.each do |associated| 19 object_name =
    associated.class.name.underscore 20 options = { 21 :object_name => object_name 22 }.update(options || {})
    23 pane_options = {
    24 :object_name =>
    options.delete(:object_name), 25 :controller => options.delete(:controller) ||
    self.controller, 26
    :foreign_key => association_foreign_key 27 } 28
    sub_pane = SinglePane.new(template, associated, pane_options) 29 sub_pane.parent = self 30 sub_pane.process_with_tag(options,
    &block) 31
    @child_index += 1 32 end
    33 end 34 35 36
    def link_to_new(link_name, options = {}, html_options = {}) 37 html_options[:id] ||=
    "#{id}_#{association_name}_new" 38 link_id = html_options[:id] 39 options = { 40 :method => :get, 41 :update => link_id,
    42 :position =>
    :before, 43 :object_name
    => controller.to_s.singularize, 44 :url => new_url do |parameters| 45 if object.respond_to?(:new_record?)
    && !object.new_record? 46
    parameters[:"#{@reflection.class_name.underscore}[#{association_foreign
    key}]"] = object.id 47 end 48 end 49 }.update(options || {}) 50 base_script = remote_function(options) 51 #
    %{...}を使わないのはrcovのせいです。 52 script = <<-"EOS"
    53 (function(){
    54 var base_script =
    "#{base_script}"; 55 var child_index = #{@child_index}; 56 var child_index_holder = new
    RegExp(RegExp.escape("#{escaped_place_holder(:child_index)}"));
    57
    Event.observe("#{link_id}", "click", function(event){
    58 var script =
    base_script.gsub(child_index_holder, child_index); 59 eval(script); 60 child_index++; 61 Event.stop(event); 62 }, true); 63 })(); 64 EOS 65 script =
    script.split(/$/).map(&:strip).join 66 link_to(link_name, 'javascript:void(0)', html_options)
    << 67
    javascript_tag(script) 68 end 69 70
    def new_url 71 nested_ajax
    = { 72 :foreign_key =>
    association_foreign_key, 73 :in_form => in_form?, 74 :form_name => form_name
    75 } 76 nested_ajax[:pane_id] = pane_id +
    '_' << place_holder(:child_index) 77 result = {:controller => controller, :action =>
    :new, :nested_ajax => nested_ajax} 78 yield(result) if block_given? 79 result 80 end 81 82 def form_name 83 unless @form_name 84 @form_name = form_name_with_parent 85 @form_name <<
    "[#{place_holder(:child_index)}]" 86 logger.debug("HasManyPane.form_name @form_name
    => #{@form_name}") 87 end 88 @form_name 89 end 90 91
    end 92 end 93 end 

Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.

Valid XHTML 1.0! Valid CSS!