Sha256: c8f9b6ce0ba3574e71be256f0c4e1e06b14f33c342d476f162cb20b4ac924bfd

Contents?: true

Size: 532 Bytes

Versions: 2

Compression:

Stored size: 532 Bytes

Contents

module Jacaranda 
  module ClassMethods

    private

      def create_predicate_methods
        inclusion_validators.each do |v| 
          v.options[:in].each do |content|
            define_method build_predicate_name(v.attributes.first, content) do
              send(v.attributes.first) == content
            end
          end
        end
      end

      def build_predicate_name(column, name)
        if configuration[:scoped]
          "#{name}_#{column}?"
        else
          "#{name}?"
        end
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jacaranda-0.0.2 lib/jacaranda/predicate.rb
jacaranda-0.0.1 lib/jacaranda/predicate.rb