Sha256: 544feecae1690cbfea4f105015215fd0bb59adf5cb2d30136fe19eb45996d05e

Contents?: true

Size: 383 Bytes

Versions: 7

Compression:

Stored size: 383 Bytes

Contents

module InferredCrumpets
  class SubjectFinder
    def self.for_context(context)
      new(context).call
    end

    def initialize(context)
      @context = context
    end

    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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
inferred_crumpets-0.7.0 lib/inferred_crumpets/subject_finder.rb
inferred_crumpets-0.6.0 lib/inferred_crumpets/subject_finder.rb
inferred_crumpets-0.5.0 lib/inferred_crumpets/subject_finder.rb
inferred_crumpets-0.4.2 lib/inferred_crumpets/subject_finder.rb
inferred_crumpets-0.4.1 lib/inferred_crumpets/subject_finder.rb
inferred_crumpets-0.4.0 lib/inferred_crumpets/subject_finder.rb
inferred_crumpets-0.3.0 lib/inferred_crumpets/subject_finder.rb