Module: Secrett11tto::Utils

Defined in:
lib/secrett11tto.rb

Constant Summary collapse

ALL_VOCABULARY =
((32..255).collect{|e| e.chr}.join.gsub(/[^[:print:]]/,'').chars) - ['"', "'", '<', '>', '\\', '/']
CSS_VOCABULARY =
('0'..'9').to_a + ('a'..'z').to_a + ('A'..'Z').to_a + ['_']

Class Method Summary collapse

Class Method Details

.cssObject



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

def Utils.css
  [
    "position: absolute",
    "top: -#{rand(100_000..500_000)}px",
    "left: -#{rand(100_000..500_000)}px",
    # "width: 0",
    # "height: 0",
    # "display: inline"
  ].shuffle.join(";")
end

.css_klass(klass) ⇒ Object



28
29
30
# File 'lib/secrett11tto.rb', line 28

def Utils.css_klass(klass)
  " .#{klass} { #{css} }"
end

.klass_name(len = 5..15) ⇒ Object



13
14
15
# File 'lib/secrett11tto.rb', line 13

def Utils.klass_name(len = 5..15)
  ('A'..'Z').to_a.sample + CSS_VOCABULARY.sample(len.to_a.sample).join
end

.tagObject



9
10
11
# File 'lib/secrett11tto.rb', line 9

def Utils.tag
  ['i', 'span', 'em', 'small', 'sup'].sample
end