Module: Metaipsum

Defined in:
lib/metaipsum.rb,
lib/metaipsum/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.clipboardObject



26
27
28
29
30
31
# File 'lib/metaipsum.rb', line 26

def self.clipboard

  Clipboard.copy "foo"
  Clipboard.paste

end

.countObject



12
13
14
15
16
# File 'lib/metaipsum.rb', line 12

def self.count

  count = Random.rand(20..30)

end

.generatorObject



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
# File 'lib/metaipsum.rb', line 34

def self.generator

  base = ARGV[0]

  gen = File.open("#{base}").read
  
  if gen.split.size > 10 

    array = gen.split(/ /) 

    count = Metaipsum.count

    ipsum = "Metaipsum ruby etc "

    count.times do
      ipsum << array.sample + " "
    end

    Clipboard.copy ipsum
    
    print <<-eos
    You passed in:
    #{ gen }
    
    Here is your ipsum text:
    #{ ipsum }

    It has been copied to your clipboard.

    eos


  else

    return nil
    
  end

rescue Errno::ENOENT => e

  print <<-eos 
  You just broke everything. Just kidding - maybe you forgot to specify a file?"
  USAGE: metaipsum <filename>
  eos

end

.loadObject



18
19
20
21
22
23
24
# File 'lib/metaipsum.rb', line 18

def self.load
  # Test for smaller files
  base = ARGV[0]

  gen = File.open("#{base}").read

end

.versionObject



6
7
8
9
10
# File 'lib/metaipsum.rb', line 6

def self.version

  "Metaipsum version #{Metaipsum::VERSION}"

end