Sha256: a068be25aaf5a074dc835bdd37319176c36dd82a0508b256d7626b05eb1e5f65

Contents?: true

Size: 480 Bytes

Versions: 3

Compression:

Stored size: 480 Bytes

Contents

module Daywalker
  
  class DynamicFinderMatch # :nodoc:
    attr_accessor :finder, :attribute_names
    def initialize(method)
      case method.to_s
       when /^(unique|all)_by_([_a-zA-Z]\w*)$/
         @finder = $1.to_sym
         @attribute_names = $2.split('_and_').map {|each| each.to_sym}
      end
    end

    def match?
      @attribute_names && @attribute_names.all? do |each|
        Daywalker::Legislator::VALID_ATTRIBUTES.include? each
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
technicalpickles-daywalker-0.2.0 lib/daywalker/dynamic_finder_match.rb
technicalpickles-daywalker-0.2.1 lib/daywalker/dynamic_finder_match.rb
technicalpickles-daywalker-0.3.1 lib/daywalker/dynamic_finder_match.rb