module DTVTournaments

Constants and helper

Constants

FETCHINGURL

Attributes

cache[W]
cache_configuration[W]

Public Class Methods

cache_configuration() click to toggle source
# File lib/dtv_tournaments/cache.rb, line 8
def self.cache_configuration
  reset_cache_config if @cache_configuration.nil?
  @cache_configuration
end
configure_cache() { |cache_configuration| ... } click to toggle source
# File lib/dtv_tournaments/cache.rb, line 17
def self.configure_cache
  yield(cache_configuration)
end
convertToText(content) click to toggle source
# File lib/dtv_tournaments/utilities.rb, line 5
def self.convertToText content
  if content.class == String
    content
  else
    content.text
  end
end
get(number, rerun=false) click to toggle source
# File lib/dtv_tournaments.rb, line 9
def self.get number, rerun=false
  if rerun
    DTVTournaments::Tournament.new(number)
  else
    DTVTournaments.get_cached_tournament(number)
  end
end
get_cache() click to toggle source
# File lib/dtv_tournaments/cache.rb, line 21
def self.get_cache
  @cache ||= Cache.new
end
get_cached_tournament(number) click to toggle source
# File lib/dtv_tournaments.rb, line 17
def self.get_cached_tournament(number)
  cached = DTVTournaments.get_cache.get_by_number(number)
  if cached.nil?
    DTVTournaments.get(number, true)
  else
    cached
  end
end
get_subelement_if_available(element, selector) click to toggle source
# File lib/dtv_tournaments/utilities.rb, line 13
def self.get_subelement_if_available(element, selector)
  unless element.search(selector).first.nil?
    element.search(selector).first.text
  else
    nil
  end
end
reset_cache_config() click to toggle source
# File lib/dtv_tournaments/cache.rb, line 13
def self.reset_cache_config
  @cache_configuration = {:host => '127.0.0.1', :port => 6379, :db => 1, :active => false}
end