lib/pickle/config.rb in ianwhite-pickle-0.1.4 vs lib/pickle/config.rb in ianwhite-pickle-0.1.5

- old
+ new

@@ -1,19 +1,10 @@ require 'ostruct' module Pickle - class << self - def config(&block) - @config ||= Config.new - ensure - @config.configure(&block) if block_given? - end - alias_method :configure, :config - end - class Config - attr_writer :adapters, :factories, :mappings + attr_writer :adapters, :factories, :mappings, :predicates def initialize(&block) configure(&block) if block_given? end @@ -35,9 +26,15 @@ end end def factory_names factories.keys + end + + def predicates + @predicates ||= Pickle::Adapter.model_classes.map do |klass| + klass.public_instance_methods.select{|m| m =~ /\?$/} + klass.column_names + end.flatten.uniq end def mappings @mappings ||= [] end \ No newline at end of file