centaur 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,14 @@
1
+ centaur
2
+ =======
3
+
4
+ Usage:
5
+ "Such A Beastly String".centaur
6
+ "Such A Beastly String".centaur!
7
+ centaur "Such A Beastly String"
8
+
9
+ Credits:
10
+
11
+ Tim Pope
12
+ Robert Pitts
13
+
14
+ Inspired by <http://textaligncentaur.com> by Cameron Daigle
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/centaur.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "centaur/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "centaur"
7
+ s.version = Centaur::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Robert Pitts"]
10
+ s.email = ["rbxbxdev@gmail.com"]
11
+ s.homepage = "http://textaligncentaur.com"
12
+ s.summary = %q{Surely you've wanted your strings to be centaurs, eh?}
13
+ s.description = %q{Surely you've wanted your strings to be centaurs, eh?}
14
+
15
+ s.rubyforge_project = "centaur"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
data/lib/README.md ADDED
@@ -0,0 +1,12 @@
1
+ CENTAUR
2
+ -------
3
+
4
+ Usage:
5
+ "Such A Beastly String".centaur
6
+ "Such A Beastly String".centaur!
7
+ centaur "Such A Beastly String"
8
+
9
+ Credits:
10
+ Tim Pope
11
+ Robert Pitts
12
+ Inspired by <http://textaligncentaur.com> by Cameron Daigle
@@ -0,0 +1,3 @@
1
+ module Centaur
2
+ VERSION = "0.0.1"
3
+ end
data/lib/centaur.rb ADDED
@@ -0,0 +1,70 @@
1
+ class String
2
+ CENTAUR = <<-EOS
3
+ x
4
+ xxx
5
+ xxx
6
+ xxx
7
+ xxx
8
+ xxx
9
+ xxx
10
+ xxxxxxx xxxxx
11
+ xxx xxxxxxx xxx
12
+ xxx xxxxxxx xxx
13
+ xxx xxxxxxx xxx
14
+ xxx xxx xxx
15
+ xxxx xxxxx xxxx
16
+ xxxxxxxxxxxxxxxxxxxxxxxx
17
+ xxxxxxxxxxxxx
18
+ xxxxxxxxxx
19
+ xxxxxxxxxx
20
+ xxxxxxxxxx
21
+ xxxxxxxxxx
22
+ xxxxxxxxxxxxxx xxxxxxxxxx
23
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
24
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
25
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
26
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
27
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxx
28
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxx
29
+ xxxxxxxx xxxxxxxxxxxxx xxxx
30
+ xxxxxx xxxxxxxx xxxx
31
+ xxxx xxxxxx xxx
32
+ xxxx xxxxx xx
33
+ xxxx xxxxx xx
34
+ xxxx xxxxx x
35
+ xxxx xxxxx
36
+ xxxx xxxx
37
+ xxxx xxxx
38
+ xxxxxx xxxxxx
39
+ xxxxxx xxxxxx
40
+ EOS
41
+
42
+ def shift
43
+ slice!(0)
44
+ end
45
+
46
+ def centaur!
47
+ gsub!(/\s/, '')
48
+ centaur_length = CENTAUR.scan(/x/).length
49
+ if length < centaur_length
50
+ self << self while length < centaur_length
51
+ slice!(centaur_length, length)
52
+ end
53
+ output = ''
54
+ CENTAUR.each_char do |char|
55
+ output << if char =~ /\s/ then char else shift end
56
+ end
57
+ replace(output)
58
+ end
59
+
60
+ def centaur
61
+ dup.centaur!
62
+ end
63
+ end
64
+
65
+
66
+ module Kernel
67
+ def centaur(string = 'x')
68
+ puts string.centaur
69
+ end
70
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: centaur
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Robert Pitts
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-03-30 00:00:00 -04:00
14
+ default_executable:
15
+ dependencies: []
16
+
17
+ description: Surely you've wanted your strings to be centaurs, eh?
18
+ email:
19
+ - rbxbxdev@gmail.com
20
+ executables: []
21
+
22
+ extensions: []
23
+
24
+ extra_rdoc_files: []
25
+
26
+ files:
27
+ - .gitignore
28
+ - Gemfile
29
+ - README.md
30
+ - Rakefile
31
+ - centaur.gemspec
32
+ - lib/README.md
33
+ - lib/centaur.rb
34
+ - lib/centaur/version.rb
35
+ has_rdoc: true
36
+ homepage: http://textaligncentaur.com
37
+ licenses: []
38
+
39
+ post_install_message:
40
+ rdoc_options: []
41
+
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ requirements: []
57
+
58
+ rubyforge_project: centaur
59
+ rubygems_version: 1.6.2
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: Surely you've wanted your strings to be centaurs, eh?
63
+ test_files: []
64
+