Class: Ayadn::Set

Inherits:
Thor
  • Object
show all
Defined in:
lib/ayadn/set.rb

Instance Method Summary collapse

Instance Method Details

#backup(*args) ⇒ Object



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/ayadn/set.rb', line 115

def backup(*args)
  backup_config = SetBackup.new
  if args[0]
    begin
      backup_config.send(args[0], args[1])
    rescue NoMethodError, ArgumentError
      puts Status.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    abort(Status.error_missing_parameters)
  end
  backup_config.save
end

#color(*args) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/ayadn/set.rb', line 96

def color(*args)
  color_config = SetColor.new
  if args[0]
    begin
      color_config.send(args[0], args[1])
    rescue NoMethodError, ArgumentError
      puts Status.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    abort(Status.error_missing_parameters)
  end
  color_config.save
end

#count(*args) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/ayadn/set.rb', line 74

def count(*args)
  counts_config = SetCounts.new
  if args[0]
    begin
      counts_config.send(args[0], args[1])
    rescue NoMethodError, ArgumentError
      puts Status.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    abort(Status.error_missing_parameters)
  end
  counts_config.save
end

#defaultsObject



134
135
136
137
# File 'lib/ayadn/set.rb', line 134

def defaults
  Settings.restore_defaults
  puts Status.done
end

#formats(*args) ⇒ Object



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/ayadn/set.rb', line 140

def formats(*args)
  formats_config = SetFormats.new
  if args[0]
    begin
      command = args.shift
      formats_config.send(command, args)
    rescue NoMethodError, ArgumentError
      puts Status.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    abort(Status.error_missing_parameters)
  end
  formats_config.save
end

#movie(*args) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/ayadn/set.rb', line 18

def movie(*args)
  movie_config = SetMovie.new
  unless args.length != 2
    movie_config.send(args[0], args[1])
  else
    abort(Status.error_missing_parameters)
  end
  movie_config.save
end

#nicerank(*args) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/ayadn/set.rb', line 42

def nicerank *args
  nicerank_config = SetNiceRank.new
  if args[0]
    nicerank_config.send(args[0], args[1])
  else
    abort(Status.error_missing_parameters)
  end
  nicerank_config.save
end

#scroll(*args) ⇒ Object



6
7
8
9
10
11
12
13
14
# 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
    abort(Status.error_missing_parameters)
  end
  scroll_config.save
end

#timeline(*args) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/ayadn/set.rb', line 54

def timeline(*args)
  timeline_config = SetTimeline.new
  if args[0]
    begin
      timeline_config.send(args[0], args[1])
    rescue NoMethodError, ArgumentError
      puts Status.error_missing_parameters
      exit
    rescue => e
      raise e
    end
  else
    abort(Status.error_missing_parameters)
  end
  timeline_config.save
end

#tvshow(*args) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/ayadn/set.rb', line 30

def tvshow(*args)
  tvshow_config = SetTVShow.new
  unless args.length != 2
    tvshow_config.send(args[0], args[1])
  else
    abort(Status.error_missing_parameters)
  end
  tvshow_config.save
end