Class: Daywalker::DynamicFinderMatch

Inherits:
Object
  • Object
show all
Defined in:
lib/daywalker/dynamic_finder_match.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method) ⇒ DynamicFinderMatch

Returns a new instance of DynamicFinderMatch.



5
6
7
8
9
10
11
# File 'lib/daywalker/dynamic_finder_match.rb', line 5

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

Instance Attribute Details

#attribute_namesObject

Returns the value of attribute attribute_names.



4
5
6
# File 'lib/daywalker/dynamic_finder_match.rb', line 4

def attribute_names
  @attribute_names
end

#finderObject

Returns the value of attribute finder.



4
5
6
# File 'lib/daywalker/dynamic_finder_match.rb', line 4

def finder
  @finder
end

Instance Method Details

#match?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/daywalker/dynamic_finder_match.rb', line 13

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