class Screenpress::Config

Attributes

enabled[RW]

Public Instance Methods

comparator() click to toggle source
# File lib/screenpress/config.rb, line 49
def comparator
  @comparator ||= calc_comparator
  @comparator
end
comparator=(val) click to toggle source
# File lib/screenpress/config.rb, line 45
def comparator=val
  @comparator = val
end
enabled?() click to toggle source
# File lib/screenpress/config.rb, line 31
def enabled?
  return !!@calc_enabled if defined?(@calc_enabled)
  @calc_enabled = calc_enabled
end
full_path() click to toggle source
# File lib/screenpress/config.rb, line 13
def full_path
  self.path = "screenpress" unless @full_path
  @full_path
end
full_path=(val) click to toggle source
# File lib/screenpress/config.rb, line 9
def full_path=val
  @full_path = Pathname.new(val).expand_path
end
full_tmp_path() click to toggle source
# File lib/screenpress/config.rb, line 26
def full_tmp_path
  self.tmp_path = "tmp" unless @full_tmp_path
  @full_tmp_path
end
full_tmp_path=(val) click to toggle source
# File lib/screenpress/config.rb, line 22
def full_tmp_path=val
  @full_tmp_path = Pathname.new(val).expand_path
end
path=(val) click to toggle source
# File lib/screenpress/config.rb, line 5
def path=val
  self.full_path = root.join(val)
end
threshold() click to toggle source
# File lib/screenpress/config.rb, line 41
def threshold
  @threshold
end
threshold=(val) click to toggle source
# File lib/screenpress/config.rb, line 36
def threshold=val
  # number between 0.0 and 100.0 for percentage of image that can change
  @threshold = val.to_f
end
tmp_path=(val) click to toggle source
# File lib/screenpress/config.rb, line 18
def tmp_path=val
  self.full_tmp_path=root.join(val)
end

Protected Instance Methods

calc_comparator() click to toggle source
# File lib/screenpress/config.rb, line 65
def calc_comparator
  # TODO: see what's there
  "bits"
end
calc_enabled() click to toggle source
# File lib/screenpress/config.rb, line 60
def calc_enabled
  # TODO env variables or something?
  true
end
calc_root_string() click to toggle source
# File lib/screenpress/config.rb, line 70
def calc_root_string
  return Rails.root.to_s                if defined?(Rails)
  return Padrino.root.to_s              if defined?(Padrino)
  return Sinatra::Application.root.to_s if defined?(Sinatra)
  return RAILS_ROOT                     if defined?(RAILS_ROOT)
  return RACK_ROOT                      if defined?(RACK_ROOT)
  return ENV['RAILS_ROOT']              if ENV['RAILS_ROOT']
  return ENV['RACK_ROOT']               if ENV['RACK_ROOT']
  return Dir.pwd
end
root() click to toggle source
# File lib/screenpress/config.rb, line 56
def root
  @root ||= Pathname.new(calc_root_string).expand_path
end