matrext 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +21 -0
- data/README.md +23 -0
- data/Rakefile +1 -0
- data/bin/matrext +49 -0
- data/lib/matrext/string_manip.rb +20 -0
- data/lib/matrext/version.rb +3 -0
- data/lib/matrext.rb +10 -0
- data/matrext.gemspec +24 -0
- data/spec/matrext_spec.rb +11 -0
- data/spec/spec_helper.rb +2 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e72c3346bc84373c2f1307d37ab5587f83b59257
|
4
|
+
data.tar.gz: 90598bc017f5ad4924e62233c224b58bd0ca8140
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0c96cd61f2d26388df66db5be1f94d262b9034d89516bd622f9e99d13ae2687b005707809da070b9e50e1c40f72cb7dbfb20f38f09c801c915761da68a352b3b
|
7
|
+
data.tar.gz: 81de85aeb3a611582a87ba141164b0a6fe0289f9d812d4962de2358add80644a2f3b349be1be7c54eb6746dd63637f09d5ca45ed329744a6bbe6d81f6dfae411
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Michael Chadwick
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Matrext
|
2
|
+
|
3
|
+
Simple Ruby gem that takes a phrase and writes it back to the screen, one letter a time, as if each character was being "decoded", Matrix-style.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'matrext'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install matrext
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
`matrext "hello world"`
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/matrext
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require_relative '../lib/matrext'
|
5
|
+
require_relative '../lib/matrext/version'
|
6
|
+
|
7
|
+
def parse_options
|
8
|
+
options = {:phrase => 'hello world'}
|
9
|
+
|
10
|
+
optparse = OptionParser.new do |opts|
|
11
|
+
opts.banner = 'usage: matrext "phrase"'
|
12
|
+
|
13
|
+
opts.on('-v', '--version', 'Display version number and exit') do
|
14
|
+
puts "#{$PROGRAM_NAME} #{Matrext::VERSION}"
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.on('-h', '--help', 'Display this screen and exit') do
|
19
|
+
puts opts
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
options[:usage] = optparse.to_s
|
25
|
+
optparse.parse!()
|
26
|
+
|
27
|
+
return options
|
28
|
+
end
|
29
|
+
|
30
|
+
def print_error(error)
|
31
|
+
case error
|
32
|
+
when OptionParser::InvalidOption
|
33
|
+
puts "#{$PROGRAM_NAME}: illegal option #{error.args.join(' ')}"
|
34
|
+
else
|
35
|
+
puts "An unexpected error occurred while running #{$PROGRAM_NAME}:"
|
36
|
+
puts " #{error}\n"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
begin
|
41
|
+
options = parse_options
|
42
|
+
|
43
|
+
phrase = ARGV[0]
|
44
|
+
|
45
|
+
Matrext::Base.new(phrase)
|
46
|
+
rescue => error
|
47
|
+
print_error(error)
|
48
|
+
exit(false)
|
49
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Matrext
|
2
|
+
CHAR_POOL = (33..126).map{ |i| i.chr }
|
3
|
+
|
4
|
+
def self.matrextify(phrase)
|
5
|
+
letters = phrase
|
6
|
+
|
7
|
+
letters.each_char do |l|
|
8
|
+
letter_noise = rand(1..10)
|
9
|
+
letter_delay = rand(0.005..0.04)
|
10
|
+
|
11
|
+
(0..letter_noise).each do |n|
|
12
|
+
print CHAR_POOL[(rand * 36).floor]
|
13
|
+
sleep(letter_delay)
|
14
|
+
print "\b"
|
15
|
+
end
|
16
|
+
print l.upcase
|
17
|
+
sleep(letter_delay)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/matrext.rb
ADDED
data/matrext.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'matrext/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'matrext'
|
8
|
+
spec.version = Matrext::VERSION
|
9
|
+
spec.platform = Gem::Platform::RUBY
|
10
|
+
spec.authors = ['Michael Chadwick']
|
11
|
+
spec.email = ['mike@codana.me']
|
12
|
+
spec.homepage = 'http://rubygems.org/gems/matrext'
|
13
|
+
spec.summary = 'Make text phrases look like they\'re being decoded, Matrix-style'
|
14
|
+
spec.description = 'Matrext takes a string input and then prints it back to the console, one letter at a time after "searching" through character noise, as if it was decoding the string itself.'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split("\n")
|
17
|
+
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
spec.license = 'MIT'
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: matrext
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Chadwick
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Matrext takes a string input and then prints it back to the console,
|
42
|
+
one letter at a time after "searching" through character noise, as if it was decoding
|
43
|
+
the string itself.
|
44
|
+
email:
|
45
|
+
- mike@codana.me
|
46
|
+
executables:
|
47
|
+
- matrext
|
48
|
+
extensions: []
|
49
|
+
extra_rdoc_files: []
|
50
|
+
files:
|
51
|
+
- ".gitignore"
|
52
|
+
- ".rspec"
|
53
|
+
- ".travis.yml"
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- bin/matrext
|
59
|
+
- lib/matrext.rb
|
60
|
+
- lib/matrext/string_manip.rb
|
61
|
+
- lib/matrext/version.rb
|
62
|
+
- matrext.gemspec
|
63
|
+
- spec/matrext_spec.rb
|
64
|
+
- spec/spec_helper.rb
|
65
|
+
homepage: http://rubygems.org/gems/matrext
|
66
|
+
licenses:
|
67
|
+
- MIT
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.4.6
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: Make text phrases look like they're being decoded, Matrix-style
|
89
|
+
test_files: []
|