module Quiver::Mapper::ClassMethods
Public Instance Methods
type_attribute(attr_name=nil)
click to toggle source
# File lib/quiver/mapper.rb, line 8 def type_attribute(attr_name=nil) if attr_name @type_attribute = attr_name end @type_attribute end
Private Instance Methods
adapter_for(adapter_type)
click to toggle source
# File lib/quiver/mapper.rb, line 64 def adapter_for(adapter_type) raise ArgumentError, 'adapter_type must not be nil' if adapter_type.nil? unnamespaced_name = name.split('::').last adapters_namespace = self.parents[-2]::Adapters.const_get(unnamespaced_name) adapters_namespace.const_get(adapter_type.to_s.camelize + 'Adapter') end
default_filter(h=nil)
click to toggle source
# File lib/quiver/mapper.rb, line 22 def default_filter(h=nil) if h h.each do |k, v| v.each do |comparator, _| unless %i|nil not_nil ~nil|.include?(comparator) raise 'Default filter only supports the nil and ~nil comparators' end end end @default_filter = h end @default_filter || {} end
filters(*args)
click to toggle source
# File lib/quiver/mapper.rb, line 18 def filters(*args) raise 'Mapper.filters is unused, it should be removed' end
hooks(hook_array=nil)
click to toggle source
# File lib/quiver/mapper.rb, line 56 def hooks(hook_array=nil) if hook_array @hooks = hook_array end @hooks end
maps(model_klass=nil)
click to toggle source
# File lib/quiver/mapper.rb, line 48 def maps(model_klass=nil) if model_klass @maps = model_klass end @maps end
sorts(*args)
click to toggle source
# File lib/quiver/mapper.rb, line 38 def sorts(*args) @sorts ||= [] if args.any? @sorts += args.map(&:to_sym) end @sorts.dup.freeze end