Skip to content

Commit

Permalink
Add #compact_paths to easily get rid of nil payloads.
Browse files Browse the repository at this point in the history
  • Loading branch information
Darrick Wiebe committed Oct 1, 2012
1 parent d8c4ee6 commit 16c5930
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/pacer/core/graph/path_route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def subgraph(target_graph = nil, opts = {})
end

def payloads
map do |path|
map element_type: :path do |path|
path.map do |e|
if e.is_a? Pacer::Payload::Element
e.payload
Expand All @@ -41,6 +41,12 @@ def payloads
end
end

def compact_paths
map element_type: :path do |path|
path.compact
end
end

protected

def configure_iterator(iter)
Expand Down

0 comments on commit 16c5930

Please sign in to comment.