Class: ResourceWithContexts

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
app/presenters/resource_with_contexts.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ResourceWithContexts

Returns a new instance of ResourceWithContexts.



4
5
6
7
# File 'app/presenters/resource_with_contexts.rb', line 4

def initialize(options)
  @resource = options.fetch(:resource)
  @graph = options.fetch(:graph)
end

Instance Method Details

#eachObject



9
10
11
12
13
# File 'app/presenters/resource_with_contexts.rb', line 9

def each
  @resource.each do |fact|
    yield FactWithContext.new(fact: fact, graph: @graph)
  end
end