Class: Html2rss::SurfaceCategory
- Inherits:
-
Object
- Object
- Html2rss::SurfaceCategory
- Defined in:
- lib/html2rss/surface_category.rb
Overview
Closed surface class for no-scraper / page-assessment gates.
Construction: AutoSource::Scraper.classify_no_scraper_surface and PageRecon.assess. Predicates own weak/blocked/listing-bonus decisions — do not re-list WEAK sets in Policy/Scorer.
Constant Summary collapse
- WEAK =
Surfaces that warrant listing/feed resolution (hubs / shells — not blocked).
Set[:high_entropy_surface, :app_shell, :unsupported_surface].freeze
Instance Attribute Summary collapse
- #name ⇒ Symbol? readonly
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Boolean (also: #eql?)
- #blocked? ⇒ Boolean
- #hash ⇒ Integer
-
#initialize(name:) ⇒ SurfaceCategory
constructor
A new instance of SurfaceCategory.
-
#listing_bonus? ⇒ Boolean
Non-weak, non-blocked surface eligible for listing bonus.
- #to_sym ⇒ Symbol?
- #weak? ⇒ Boolean
Constructor Details
#initialize(name:) ⇒ SurfaceCategory
Returns a new instance of SurfaceCategory.
31 32 33 |
# File 'lib/html2rss/surface_category.rb', line 31 def initialize(name:) @name = name end |
Instance Attribute Details
#name ⇒ Symbol? (readonly)
27 28 29 |
# File 'lib/html2rss/surface_category.rb', line 27 def name @name end |
Class Method Details
.coerce(value) ⇒ SurfaceCategory
17 18 19 20 21 22 |
# File 'lib/html2rss/surface_category.rb', line 17 def coerce(value) return value if value.is_a?(self) return new(name: nil) if value.nil? new(name: value.to_sym) end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
54 55 56 |
# File 'lib/html2rss/surface_category.rb', line 54 def ==(other) other.is_a?(self.class) && name == other.name end |
#blocked? ⇒ Boolean
41 |
# File 'lib/html2rss/surface_category.rb', line 41 def blocked? = name == :blocked_surface |
#hash ⇒ Integer
61 |
# File 'lib/html2rss/surface_category.rb', line 61 def hash = [self.class, name].hash |
#listing_bonus? ⇒ Boolean
Returns non-weak, non-blocked surface eligible for listing bonus.
45 |
# File 'lib/html2rss/surface_category.rb', line 45 def listing_bonus? = !name.nil? && !weak? && !blocked? |
#to_sym ⇒ Symbol?
49 |
# File 'lib/html2rss/surface_category.rb', line 49 def to_sym = name |
#weak? ⇒ Boolean
37 |
# File 'lib/html2rss/surface_category.rb', line 37 def weak? = WEAK.include?(name) |