class Sqreen::Actions::Repository
Where the actions are stored The current ones are stored in Repository.current
Public Class Methods
new()
click to toggle source
# File lib/sqreen/actions/repository.rb, line 11 def initialize @indexes = Hash[Base.known_subclasses.map do |clazz| [clazz.type_name, clazz.new_index] end] end
Public Instance Methods
add(params, action)
click to toggle source
# File lib/sqreen/actions/repository.rb, line 17 def add(params, action) @indexes[action.class.type_name].index(params || {}, action) end
clear()
click to toggle source
# File lib/sqreen/actions/repository.rb, line 34 def clear self.current = Repository.new end
current=(new_inst)
click to toggle source
# File lib/sqreen/actions/repository.rb, line 29 def current=(new_inst) raise 'nil is unacceptable' if new_inst.nil? @current = new_inst end
get(type, key)
click to toggle source
type is either a class or a type name
# File lib/sqreen/actions/repository.rb, line 22 def get(type, key) type = type.type_name if type.class == Class @indexes[type].actions_matching key end