class Biased::Client
@author Justin Harrison
Attributes
parent[R]
The potentially biased website’s parent organization.
Public Class Methods
new(domain)
click to toggle source
@param [String] domain The potentially biased website’s domain.
# File lib/biased/client.rb, line 11 def initialize(domain) @domain = domain @parent = gather_from_wikipedia end
Public Instance Methods
gather_from_wikipedia()
click to toggle source
# File lib/biased/client.rb, line 16 def gather_from_wikipedia content = Wikipedia.find(@domain).content # Wikipedia has multiple fields for a parent organization, # so we need to try each one %w(parent owner).each do |field| # This Regex should be cleaned up. parent = /(#{field}\s*=\s\[\[)(.*\w+)/.match(content) # Capture group 2 contains only the parent value return parent[2] if parent end end