Class: Ayadn::Set

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

Instance Method Summary collapse

Instance Method Details

#backup(*args) ⇒ Object



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/ayadn/set.rb', line 126

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

#color(*args) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/ayadn/set.rb', line 105

def color(*args)
  color_config = SetColor.new
  if args[0]
    begin
      color_config.validate(args[1])
      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.log(args)
  color_config.save
end

#count(*args) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/ayadn/set.rb', line 81

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

#defaultsObject



147
148
149
150
# File 'lib/ayadn/set.rb', line 147

def defaults
  Settings.restore_defaults
  puts Status.done
end

#movie(*args) ⇒ Object



20
21
22
23
24
25
26
27
28
29
# File 'lib/ayadn/set.rb', line 20

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.log(args)
  movie_config.save
end

#nicerank(*args) ⇒ Object



46
47
48
49
50
51
52
53
54
55
# File 'lib/ayadn/set.rb', line 46

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.log(args)
  nicerank_config.save
end

#scroll(*args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ayadn/set.rb', line 6

def scroll(*args)
  scroll_config = SetScroll.new
  if args[0]
    param = scroll_config.validate(args[1])
    scroll_config.send(args[0], param)
  else
    abort(Status.error_missing_parameters)
  end
  scroll_config.log(args)
  scroll_config.save
end

#timeline(*args) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/ayadn/set.rb', line 59

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

#tvshow(*args) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/ayadn/set.rb', line 33

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.log(args)
  tvshow_config.save
end