Class: Sortah::Lens
Instance Attribute Summary
Attributes inherited from Component
#block, #name
Instance Method Summary
collapse
Methods inherited from Component
#defined?, #initialize, #run_dependencies!
Instance Method Details
#clear_state! ⇒ Object
32
|
# File 'lib/sortah/components/lens.rb', line 32
def clear_state!; @ran = false; end
|
#run!(email, context) ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/sortah/components/lens.rb', line 22
def run!(email, context)
@email = email
return if already_ran?
run_dependencies!(email, context)
result = run_block!
email.metadata(name, result) if provides_value?
end
|
#valid?(context) ⇒ Boolean
16
17
18
19
20
|
# File 'lib/sortah/components/lens.rb', line 16
def valid?(context)
dependencies.each do |lens|
raise ParseErrorException unless context.include? lens
end
end
|