C0 code coverage information

Generated on Sat Feb 02 17:44:23 +0100 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/ramaze/action.rb 129 71
96.1% 
94.4% 
  1 #          Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
  2 # All files in this distribution are subject to the terms of the Ruby license.
  3 
  4 module Ramaze
  5 
  6   unless defined?(Action) # prevent problems for SourceReload
  7 
  8     members = %w[method params template controller path binding engine instance]
  9 
 10     # The Action holds information that is essential to render the action for a
 11     # request.
 12 
 13     class Action < Struct.new('Action', *members)
 14     end
 15   end
 16 
 17   require 'ramaze/action/render'
 18 
 19   class Action
 20     class << self
 21 
 22       # Instantiate with given Hash, takes both string/symbol keys.
 23       # Only keys that match members of the Action-Struct are used.
 24 
 25       def create(hash = {})
 26         i = new
 27         members.each do |key|
 28           i.send("#{key}=", (hash[key] || hash[key.to_sym]))
 29         end
 30         i
 31       end
 32 
 33       # Thread.current[:action] returns the instance of Action you are currently in.
 34 
 35       def current
 36         Thread.current[:action]
 37       end
 38     end
 39 
 40     # nicer representation of the Action
 41 
 42     def to_s
 43       m, p, t = method.inspect, params.inspect, template.inspect
 44       %{#<Action method=#{m}, params=#{p} template=#{t}>}
 45     end
 46 
 47     # Set the method, will be converted to a string and set to nil if empty.
 48 
 49     def method=(meth)
 50       meth = meth.to_s
 51       self[:method] = (meth.empty? ? nil : meth)
 52     end
 53 
 54     # runs all parameters assigned through flatten and CGI::unescape
 55 
 56     def params=(*par)
 57       self[:params] = par.flatten.compact.map{|pa| CGI.unescape(pa.to_s)}
 58     end
 59 
 60     # Use this as key for caches.
 61 
 62     def relaxed_hash
 63       [controller, method, params, template, path].hash
 64     end
 65 
 66     # A Hash representation of Action
 67 
 68     def to_hash
 69       hash = {}
 70       members.each{|m| hash[m.to_sym] = send(m)}
 71       hash
 72     end
 73 
 74     # Determines based on controller.trait[:engine] and the template extensions
 75     # which engine has to be used.
 76     # Defaults to Template::Ezamar
 77 
 78     def engine
 79       return self[:engine] if self[:engine]
 80       default = controller.trait.fetch(:engine, Template::Ezamar)
 81       return default unless template
 82 
 83       Template::ENGINES.sort_by{|v| v.join}.each do |(engine, exts)|
 84         if template =~ /\.(#{Regexp.union(*exts)})$/
 85           return self[:engine] = engine
 86         end
 87       end
 88 
 89       self[:engine] = default
 90     end
 91 
 92     # Returns an instance of controller, will be cached on first access.
 93 
 94     def instance
 95       self[:instance] ||= controller.new
 96     end
 97 
 98     # Returns a binding of the instance, will be cached on first access.
 99 
100     def binding
101       self[:binding] ||= instance.instance_eval{ binding }
102     end
103 
104     def name
105       File.basename((self[:method] || self[:template]).to_s).split('.').first
106     end
107 
108     # combined path to current action, from path and params
109     def extended_path
110       @extended_path ||= Array[path, *params].join('/')
111     end
112 
113     # Hook for AspectHelper
114 
115     def before_process
116     end
117 
118     # Hook for AspectHelper
119 
120     def after_process
121     end
122   end
123 
124   # Shortcut to create new instances of Action via Action::fill
125 
126   def self.Action(hash = {})
127     Action.create(hash)
128   end
129 end

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

Valid XHTML 1.0! Valid CSS!