class FortuneFinder::Record

Public Class Methods

new(raw_domain) click to toggle source
# File lib/fortune-finder/record.rb, line 4
def initialize(raw_domain)
  @raw_domain = raw_domain.to_s
end

Public Instance Methods

alias()
Alias for: alias?
alias?() click to toggle source
# File lib/fortune-finder/record.rb, line 24
def alias?
  @alias ||= File.symlink? file_path
end
Also aliased as: alias
domain() click to toggle source
# File lib/fortune-finder/record.rb, line 12
def domain
  @domain ||= toml["domain"] if exists?
end
exists?() click to toggle source
# File lib/fortune-finder/record.rb, line 8
def exists?
  @exits ||= File.exists? file_path
end
name() click to toggle source
# File lib/fortune-finder/record.rb, line 16
def name
  @name ||= toml["name"] if exists?
end
rank() click to toggle source
# File lib/fortune-finder/record.rb, line 20
def rank
  @rank ||= toml["rank"] if exists?
end

Private Instance Methods

file_path() click to toggle source
# File lib/fortune-finder/record.rb, line 31
def file_path
  @file_path ||= File.expand_path "#{@raw_domain}.toml", FortuneFinder.domains_path
end
toml() click to toggle source
# File lib/fortune-finder/record.rb, line 35
def toml
   @toml ||= TOML.load_file file_path
end