Class: Looksy::DynamicFindMatch
- Inherits:
-
Struct
- Object
- Struct
- Looksy::DynamicFindMatch
- Defined in:
- lib/looksy/dynamic_find_match.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#extractor ⇒ Object
Returns the value of attribute extractor.
-
#finder ⇒ Object
Returns the value of attribute finder.
Class Method Summary collapse
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes
2 3 4 |
# File 'lib/looksy/dynamic_find_match.rb', line 2 def attributes @attributes end |
#extractor ⇒ Object
Returns the value of attribute extractor
2 3 4 |
# File 'lib/looksy/dynamic_find_match.rb', line 2 def extractor @extractor end |
#finder ⇒ Object
Returns the value of attribute finder
2 3 4 |
# File 'lib/looksy/dynamic_find_match.rb', line 2 def finder @finder end |
Class Method Details
.match(method) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/looksy/dynamic_find_match.rb', line 3 def self.match(method) finder = :find extractor = nil case method.to_s when /^find_(last_|all_)?by_([_a-zA-Z]\w*)$/ case $1 when 'last_' finder = :select extractor = :last when 'all_' finder = :select end attributes = $2 else return nil end new(finder, extractor, attributes.split('_and_')) end |