class Ayadn::Set

Public Instance Methods

api(*args) click to toggle source
# File lib/ayadn/set.rb, line 197
def api(*args)
  if args[0]
    begin
      SetAPI.new.setURL(args[0])
    rescue NoMethodError, ArgumentError => e
      Status.new.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    Status.new.error_missing_parameters
    exit
  end
end
backup(*args) click to toggle source
# File lib/ayadn/set.rb, line 151
def backup(*args)
  backup_config = SetBackup.new
  if args[0]
    begin
      backup_config.send(args[0], args[1])
    rescue NoMethodError, ArgumentError
      Status.new.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    Status.new.error_missing_parameters
    exit
  end
  backup_config.save
end
blacklist(*args) click to toggle source
# File lib/ayadn/set.rb, line 44
def blacklist(*args)
  blacklist_config = SetBlacklist.new
  unless args.length != 2
    blacklist_config.send(args[0], args[1])
  else
    Status.new.error_missing_parameters
    exit
  end
  blacklist_config.save
end
channels(*args) click to toggle source
# File lib/ayadn/set.rb, line 32
def channels(*args)
  channels_config = SetChannels.new
  unless args.length != 2
    channels_config.send(args[0], args[1])
  else
    Status.new.error_missing_parameters
    exit
  end
  channels_config.save
end
color(*args) click to toggle source
# File lib/ayadn/set.rb, line 131
def color(*args)
  color_config = SetColor.new
  if args[0]
    begin
      color_config.send(args[0], args[1])
    rescue NoMethodError, ArgumentError
      Status.new.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    Status.new.error_missing_parameters
    exit
  end
  color_config.save
end
count(*args) click to toggle source
# File lib/ayadn/set.rb, line 91
def count(*args)
  counts_config = SetCounts.new
  if args[0]
    begin
      counts_config.send(args[0], args[1])
    rescue NoMethodError, ArgumentError
      Status.new.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    Status.new.error_missing_parameters
    exit
  end
  counts_config.save
end
defaults() click to toggle source
# File lib/ayadn/set.rb, line 171
def defaults
  Settings.restore_defaults
  Status.new.done
end
edit() click to toggle source
# File lib/ayadn/set.rb, line 110
def edit
  Settings.load_config()
  sets = Settings.config.paths.config + "/config.yml"
  if sets.blank?
    Status.new.not_authorized
    exit
  end
  ed = `echo $EDITOR`
  if ed.blank?
    Status.new.info "No predefined EDITOR, opening in VIM"
    `vim #{sets}`
    exit
  end
  `$EDITOR #{sets}`
end
formats(*args) click to toggle source
# File lib/ayadn/set.rb, line 177
def formats(*args)
  formats_config = SetFormats.new
  if args[0]
    begin
      command = args.shift
      formats_config.send(command, args)
    rescue NoMethodError, ArgumentError
      Status.new.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    Status.new.error_missing_parameters
    exit
  end
  formats_config.save
end
marker(*args) click to toggle source
# File lib/ayadn/set.rb, line 19
def marker(*args)
  marker_config = SetMarker.new
  unless args.length != 2
    marker_config.send(args[0], args[1])
  else
    Status.new.error_missing_parameters
    exit
  end
  marker_config.save
end
nicerank(*args) click to toggle source
# File lib/ayadn/set.rb, line 57
def nicerank *args
  nicerank_config = SetNiceRank.new
  if args[0]
    nicerank_config.send(args[0], args[1])
  else
    Status.new.error_missing_parameters
    exit
  end
  nicerank_config.save
end
scroll(*args) click to toggle source
# File lib/ayadn/set.rb, line 6
def scroll(*args)
  scroll_config = SetScroll.new
  if args[0]
    scroll_config.send(args[0], args[1])
  else
    Status.new.error_missing_parameters
    exit
  end
  scroll_config.save
end
timeline(*args) click to toggle source
# File lib/ayadn/set.rb, line 70
def timeline(*args)
  timeline_config = SetTimeline.new
  if args[0]
    begin
      timeline_config.send(args[0], args[1])
    rescue NoMethodError, ArgumentError
      Status.new.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    Status.new.error_missing_parameters
    exit
  end
  timeline_config.save
end