Class: Fitting::Report::Actions

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

Defined Under Namespace

Classes: Empty, NotFound

Instance Method Summary collapse

Constructor Details

#initialize(actions) ⇒ Actions

Returns a new instance of Actions.



20
21
22
23
24
25
# File 'lib/fitting/report/actions.rb', line 20

def initialize(actions)
  @actions = []
  actions.to_a.map do |action|
    @actions.push(Fitting::Report::Action.new(action))
  end
end

Instance Method Details

#cover!Object



16
17
18
# File 'lib/fitting/report/actions.rb', line 16

def cover!

end

#find!(log) ⇒ Object

Raises:



27
28
29
30
31
32
33
34
35
# File 'lib/fitting/report/actions.rb', line 27

def find!(log)
  raise Empty if @actions.empty?
  @actions.map do |action|
    if log.method == action.method && action.path_match(log.path)
      return action
    end
  end
  raise NotFound.new("method: #{log.method}, host: #{log.host}, path: #{log.path}", log)
end

#push(actions) ⇒ Object



41
42
43
# File 'lib/fitting/report/actions.rb', line 41

def push(actions)
  @actions += actions.to_a
end

#to_aObject



37
38
39
# File 'lib/fitting/report/actions.rb', line 37

def to_a
  @actions
end