Class: Catalog::DrawerMatcher
- Inherits:
-
Object
- Object
- Catalog::DrawerMatcher
- Defined in:
- lib/catalog/services/drawer_matcher.rb
Instance Attribute Summary collapse
-
#drawer ⇒ Object
readonly
Accessors.
Instance Method Summary collapse
-
#initialize(document:) ⇒ DrawerMatcher
constructor
A new instance of DrawerMatcher.
- #match? ⇒ Boolean
Constructor Details
#initialize(document:) ⇒ DrawerMatcher
Returns a new instance of DrawerMatcher.
6 7 8 |
# File 'lib/catalog/services/drawer_matcher.rb', line 6 def initialize(document:) @document = document end |
Instance Attribute Details
#drawer ⇒ Object (readonly)
Accessors
4 5 6 |
# File 'lib/catalog/services/drawer_matcher.rb', line 4 def drawer @drawer end |
Instance Method Details
#match? ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/catalog/services/drawer_matcher.rb', line 10 def match? Catalog::Drawer.all.each do |drawer| document_where_froms.each do |url| @drawer = drawer if /#{drawer.rule}/.match(url) break if @drawer end break if @drawer end !@drawer.nil? end |