Sha256: 966fa0d6e3da48bbef941898e800a0be5537e324a262572a3ef5ffde1b9c16bc
Contents?: true
Size: 715 Bytes
Versions: 8
Compression:
Stored size: 715 Bytes
Contents
module Nyanko module Unit class ScopeFinder LABEL_SCOPE_MAP = { :controller => ActionController::Base, :model => ActiveRecord::Base, :view => ActionView::Base, } def self.find(*args) new(*args).find end def initialize(identifier) @identifier = identifier end def find case when class? @identifier when label label else @identifier.to_s.constantize end rescue NameError end private def class? @identifier.is_a?(Class) end def label LABEL_SCOPE_MAP[@identifier] end end end end
Version data entries
8 entries across 8 versions & 1 rubygems