Sha256: 3811eb6c4af60a4c6c5633b1ca442284cab88668253062b540584708ff2a520b

Contents?: true

Size: 388 Bytes

Versions: 6

Compression:

Stored size: 388 Bytes

Contents

class SnippetFinder
  class << self
    def find(id)
      find_map('find',id)
    end

    def find_by_name(name)
      find_map('find_by_name', name)
    end

    def finder_types
      [SnippetFile, Snippet]
    end

    private

    def find_map(meth, *args)
      finder_types.find{|type|
        found = type.send(meth, *args)
        return found if found
      }
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
trusty-snippets-extension-1.0.0 app/models/snippet_finder.rb
radiant-snippets-extension-1.1.3 app/models/snippet_finder.rb
radiant-snippets-extension-1.1.2 app/models/snippet_finder.rb
radiant-snippets-extension-1.1.1 app/models/snippet_finder.rb
radiant-snippets-extension-1.1.0 app/models/snippet_finder.rb
radiant-snippets-extension-1.1.0.alpha app/models/snippet_finder.rb