class InferredCrumpets::SubjectFinder
Public Class Methods
for_context(context)
click to toggle source
# File lib/inferred_crumpets/subject_finder.rb, line 3 def self.for_context(context) new(context).call end
new(context)
click to toggle source
# File lib/inferred_crumpets/subject_finder.rb, line 7 def initialize(context) @context = context end
Public Instance Methods
call()
click to toggle source
# File lib/inferred_crumpets/subject_finder.rb, line 11 def call current_object = begin @context.current_object rescue nil end collection_object = begin @context.collection rescue nil end current_object || collection_object end end end