Class: Daywalker::DynamicFinderMatch
- Inherits:
-
Object
- Object
- Daywalker::DynamicFinderMatch
- Defined in:
- lib/daywalker/dynamic_finder_match.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#attribute_names ⇒ Object
Returns the value of attribute attribute_names.
-
#finder ⇒ Object
Returns the value of attribute finder.
Instance Method Summary collapse
-
#initialize(method) ⇒ DynamicFinderMatch
constructor
A new instance of DynamicFinderMatch.
- #match? ⇒ Boolean
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_names ⇒ Object
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 |
#finder ⇒ Object
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
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 |