forked from OneWhoFrogs/BigFriendlyRobot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
subreddits.rb
117 lines (102 loc) · 3.12 KB
/
subreddits.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
class Subreddit
attr_accessor :name, :regex, :css, :moderators, :format
Banned_words = []
def initialize
end
def valid?(input)
def clean?(input)
Banned_words.each do |word|
if input.include?(word)
return false
end
end
true
end
input == input.match(/^[a-zA-Z0-9\-\/' ]{0,40}$/).to_s and clean?(input)
end
def build_css
end
end
class BigFriendlyRobot < Subreddit
def initialize
@name = "BigFriendlyRobot"
@css = "css/bigfriendlyrobot.css"
@format = "an alphanumeric string (spaces allowed)"
@regex = /^[a-zA-Z0-9 ]+$/
end
def build_css(rows)
css = rows.inject("") do |memo, row|
memo += ".id-t2_#{row["id"]}:after {content: ' #{row['state']}' !important}\n"
end
end
end
class StLouis < Subreddit
def initialize
@name = "StLouis"
@css = "css/stlouis.css"
@format = "An alphabetical string. Spaces, commas, periods, and apostrophes are allowed."
@regex = /^[a-zA-Z .,']{0,20}$/
end
def build_css(rows)
css = rows.inject("") do |memo, row|
state = row['state']
memo += ".id-t2_#{row["id"]}:after {color: gray; font-size: 0.75em; content: \" [#{state}]\" !important}\n"
end
end
end
class Motorcycles < Subreddit
def initialize
@name = "Motorcycles"
@css = "css/motorcycles.css"
@format = "Letters, numbers, and spaces only. Text must be less than 40 characters long."
@regex = /^[a-zA-Z0-9\-\/ ]{0,40}$/
end
def build_css(rows)
css = rows.inject("") do |memo, row|
state = row['state']
memo += ".id-t2_#{row["id"]}:after {color: gray; font-size: 0.75em; content: \" #{state}\" !important}\n"
end
end
end
class Autos < Subreddit
def initialize
@name = "Autos"
@css = "css/autos.css"
@format = "Letters, numbers, spaces, dashes, and apostrophes only. Text must be shorter than or equal to 40 characters in length."
@regex = /^[a-zA-Z0-9\-\/' ]{0,40}$/
end
def build_css(rows)
css = rows.inject("") do |memo, row|
state = row['state']
memo += ".id-t2_#{row["id"]}:after {color: gray; font-size: 0.75em; content: \" [#{state}]\" !important}\n"
end
end
end
class Cars < Subreddit
def initialize
@name = "Cars"
@css = "css/cars.css"
@regex = /^[a-zA-Z0-9\-\/' ]{0,40}$/
@format = "Letters, numbers, spaces, dashes, and apostrophes only. Text must be shorter than or equal to 40 characters in length."
end
def build_css(rows)
css = rows.inject("") do |memo, row|
state = row['state']
memo += ".id-t2_#{row["id"]}:after {color: gray; font-size: 0.8em; content: \" [#{state}]\" !important}\n"
end
end
end
class Sailing < Subreddit
def initialize
@name = "Sailing"
@css = "css/sailing.css"
@regex = /^[a-zA-Z0-9\-\/' ]{0,40}$/
@format = "Letters, numbers, spaces, dashes, and apostrophes only. Text must be shorter than or equal to 40 characters in length."
end
def build_css(rows)
css = rows.inject("") do |memo, row|
state = row['state']
memo += ".id-t2_#{row["id"]}:after {color: gray; font-size: 0.8em; content: \" [#{state}]\" !important}\n"
end
end
end