C0 code coverage information

Generated on Mon Nov 03 16:07:05 +0900 2008 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/twowaysql/template.rb 97 30
100.0%  
100.0%  
 1
    module TwoWaySQL  2
     3 # TwoWaySQL::Template
    represents template object, acts as a Facade for this package.  4 # Template is stateless, reentrant
    object so template object is cacheable.  5 class Template  6  7 #
    parse TwoWaySQL-style SQL then return TwoWaySQL::Template object
     8 #  9 # === Usage 10 # 11 # sql = "SELECT * FROM emp
    WHERE job = /*ctx[:job]*/'CLERK' AND deptno = /*ctx[:deptno]*/20"
    12 # template =
    TwoWaySQL::Template.parse(sql) 13 # 14 # === Arguments 15 # 16 # +sql_io+:: 17 # IO-like object that contains TwoWaySQL-style SQL
    18 # 19 # +opts+:: 20 # (optional) Hash of parse options
    to pass internal lexer. default is empty hash. 21 # 22 # === Return 23 # 24 # TwoWaySQL::Template object that
    represents parse result 25 # 26
    def Template.parse(sql_io, opts={}) 27 parser = Parser.new(opts) 28 root = parser.parse(sql_io)
    29 Template.new(root)
    30 end 31 32 # merge data with template 33 # 34 # === Usage 35 # 36 # merged = template.merge(:job
    => "MANAGER", :deptno => 30) 37 # merged.sql #=> "SELECT *
    FROM emp WHERE job = ? AND deptno = ?" 38 # merged.bound_variables #=>
    ["MANAGER", 30] 39 # 40 # === Arguments 41 # 42 # +data+:: 43 # Hash-like object that contains data to merge. This
    data will evaluated as name 'ctx'. 44 # 45 # === Return 46 # 47 # TwoWaySQL::MergeResult object that represents merge
    result 48 # 49 def merge(data) 50 c = Context.new(data) 51 @root.accept(c) 52 MergeResult.new(c) 53 end 54 55 protected 56 def initialize(root) 57 @root = root 58 end 59 end 60 61
    62 #
    TwoWaySQL::MergeResult represents merge result of template and data.
    63 # it contains SQL
    string with placeholders, and bound variables associated with placeholders.
    64 # 65 # === Usage 66 # 67 # merged = template.merge(:job
    => "MANAGER", :deptno => 30) 68 # merged.sql #=> "SELECT *
    FROM emp WHERE job = ? AND deptno = ?" 69 # merged.bound_variables #=>
    ["MANAGER", 30] 70 # 71
    class MergeResult 72 def
    initialize(context) 73
    @context = context 74
    end 75 76 # return merge result SQL with
    placeholders (question mark). 77 # 78 # === Return 79 # merge result SQL with placeholders 80 # 81 def sql 82 @context.sql 83 end 84 85
    # return array of variables which indices are corresponding to placeholders.
    86 # alias 'vars' is
    available for short-hand. 87 # 88 # === Return 89 # array of bound variables 90 # 91 def bound_variables 92 @context.bound_variables 93 end 94 alias vars bound_variables
    95 end 96 97 end 

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

Valid XHTML 1.0! Valid CSS!