Class: CMSScanner::Model::InterestingFinding
- Inherits:
-
Object
- Object
- CMSScanner::Model::InterestingFinding
- Includes:
- Finders::Finding
- Defined in:
- app/models/interesting_finding.rb
Overview
Interesting Finding
Direct Known Subclasses
FantasticoFileslist, Headers, RobotsTxt, SearchReplaceDB2, XMLRPC
Constant Summary
Constants included from Finders::Finding
Finders::Finding::FINDING_OPTS
Instance Attribute Summary collapse
- #to_s ⇒ String
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #==(other) ⇒ Boolean
- #entries ⇒ Array<String>
-
#initialize(url, opts = {}) ⇒ InterestingFinding
constructor
A new instance of InterestingFinding.
- #type ⇒ String
Methods included from Finders::Finding
#<=>, #confidence, #confidence=, #confirmed_by, #eql?, included, #interesting_entries, #parse_finding_options
Constructor Details
#initialize(url, opts = {}) ⇒ InterestingFinding
Returns a new instance of InterestingFinding.
16 17 18 19 20 21 |
# File 'app/models/interesting_finding.rb', line 16 def initialize(url, opts = {}) @url = url @to_s = opts[:to_s] (opts) end |
Instance Attribute Details
#to_s ⇒ String
33 34 35 |
# File 'app/models/interesting_finding.rb', line 33 def to_s @to_s || url end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'app/models/interesting_finding.rb', line 9 def url @url end |
Instance Method Details
#==(other) ⇒ Boolean
43 44 45 |
# File 'app/models/interesting_finding.rb', line 43 def ==(other) self.class == other.class && to_s == other.to_s end |
#entries ⇒ Array<String>
24 25 26 27 28 29 30 |
# File 'app/models/interesting_finding.rb', line 24 def entries res = NS::Browser.get(url) return [] unless res && res.headers['Content-Type'] =~ %r{\Atext/plain;}i res.body.split("\n").reject { |s| s.strip.empty? } end |
#type ⇒ String
38 39 40 |
# File 'app/models/interesting_finding.rb', line 38 def type @type ||= self.class.to_s.demodulize.underscore end |