lib/pickle/config.rb in ianwhite-pickle-0.1.5 vs lib/pickle/config.rb in ianwhite-pickle-0.1.6
- old
+ new
@@ -23,18 +23,14 @@
def factories
@factories ||= adapter_classes.reverse.inject({}) do |factories, adapter|
factories.merge(adapter.factories.inject({}){|h, f| h.merge(f.name => f)})
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
+ @predicates ||= Pickle::Adapter.model_classes.map do |k|
+ k.public_instance_methods.select{|m| m =~ /\?$/} + k.column_names
end.flatten.uniq
end
def mappings
@mappings ||= []
@@ -42,10 +38,11 @@
# Usage: map 'me', 'myself', 'I', :to => 'user: "me"'
def map(*args)
options = args.extract_options!
raise ArgumentError, "Usage: map 'search' [, 'search2', ...] :to => 'replace'" unless args.any? && options[:to].is_a?(String)
- search = args.size == 1 ? args.first.to_s : "(?:#{args.join('|')})"
- self.mappings << OpenStruct.new(:search => search, :replace => options[:to])
+ args.each do |search|
+ self.mappings << OpenStruct.new(:search => search, :replace => options[:to])
+ end
end
end
end
\ No newline at end of file