Module: Statement

Extended by:
Utils
Defined in:
lib/statement.rb,
lib/statement/feed.rb,
lib/statement/tweets.rb,
lib/statement/scraper.rb,
lib/statement/version.rb,
lib/statement/facebook.rb

Defined Under Namespace

Classes: Facebook, Feed, Scraper, Tweets

Constant Summary collapse

VERSION =
"2.1"

Class Method Summary collapse

Methods included from Utils

absolute_link, remove_generic_urls!

Class Method Details

.configObject



41
42
43
# File 'lib/statement.rb', line 41

def self.config
  @config
end

.configure(opts = {}) ⇒ Object

Configure through hash



24
25
26
# File 'lib/statement.rb', line 24

def self.configure(opts = {})
  opts.each {|k,v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym}
end

.configure_with(path_to_yaml_file) ⇒ Object

Configure through yaml file



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/statement.rb', line 29

def self.configure_with(path_to_yaml_file)
  begin
    config = YAML::load(IO.read(path_to_yaml_file))
  rescue Errno::ENOENT
    log(:warning, "YAML configuration file couldn't be found. Using defaults."); return
  rescue Psych::SyntaxError
    log(:warning, "YAML configuration file contains invalid syntax. Using defaults."); return
  end

  configure(config)
end