Class: Request

Inherits:
Object
  • Object
show all
Defined in:
lib/report/report_parser.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRequest

Returns a new instance of Request.



26
27
# File 'lib/report/report_parser.rb', line 26

def initialize
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



22
23
24
# File 'lib/report/report_parser.rb', line 22

def action
  @action
end

#avg_timeObject

Returns the value of attribute avg_time.



25
26
27
# File 'lib/report/report_parser.rb', line 25

def avg_time
  @avg_time
end

#controllerObject

Returns the value of attribute controller.



21
22
23
# File 'lib/report/report_parser.rb', line 21

def controller
  @controller
end

#countObject

Returns the value of attribute count.



25
26
27
# File 'lib/report/report_parser.rb', line 25

def count
  @count
end

#formatObject

Returns the value of attribute format.



24
25
26
# File 'lib/report/report_parser.rb', line 24

def format
  @format
end

#max_timeObject

Returns the value of attribute max_time.



25
26
27
# File 'lib/report/report_parser.rb', line 25

def max_time
  @max_time
end

#min_timeObject

Returns the value of attribute min_time.



25
26
27
# File 'lib/report/report_parser.rb', line 25

def min_time
  @min_time
end

#std_devObject

Returns the value of attribute std_dev.



25
26
27
# File 'lib/report/report_parser.rb', line 25

def std_dev
  @std_dev
end

#verbObject

Returns the value of attribute verb.



23
24
25
# File 'lib/report/report_parser.rb', line 23

def verb
  @verb
end

Class Method Details

.create(controller, action, count, avg_time, std_dev, min_time, max_time, options = {}) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/report/report_parser.rb', line 29

def self.create(controller, action, count, avg_time, std_dev, min_time, max_time, options={})
  r = Request.new
  r.verb = options[:verb]
  r.format = options[:format]
  r.controller=controller
  r.action=action
  r.count=count
  r.avg_time=avg_time
  r.std_dev=std_dev
  r.min_time=min_time
  r.max_time=max_time
  return r
end

Instance Method Details

#fixup_controller_name!Object



43
44
45
46
47
# File 'lib/report/report_parser.rb', line 43

def fixup_controller_name!
  if @controller =~ /^Api([^:].*)Controller/
    @controller = "Api::V1::#{$1}Controller"
  end
end

#to_sObject



49
50
51
# File 'lib/report/report_parser.rb', line 49

def to_s
  "%s#%s.%s.%s" % [ controller, action, verb, format ]
end