Class: CycloneLariat::Presenters::Graph
- Inherits:
-
Object
- Object
- CycloneLariat::Presenters::Graph
- Defined in:
- lib/cyclone_lariat/presenters/graph.rb
Constant Summary collapse
- HEADS =
%w[topic endpoint subscription_arn].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(subscriptions) ⇒ Object
9 10 11 |
# File 'lib/cyclone_lariat/presenters/graph.rb', line 9 def self.call(subscriptions) new.call(subscriptions) end |
Instance Method Details
#call(subscriptions) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/cyclone_lariat/presenters/graph.rb', line 13 def call(subscriptions) return '' if subscriptions.empty? resources_set = Set.new subscriptions.each do |subscription| resources_set << subscription[:topic] resources_set << subscription[:endpoint] end [].tap do |output| output << open_graph resources_set.each { |resource| output << present_resource(resource) } subscriptions.each { |subscription| output << present_subscription(subscription) } output << close_graph end end |