aesthetify 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +17 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +25 -0
- data/LICENSE +20 -0
- data/README.md +36 -0
- data/Rakefile +12 -0
- data/aesthetify.gemspec +16 -0
- data/lib/aesthetify.rb +44 -0
- data/test/aesthetify_test.rb +36 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 26e9f57ded41bc8c54354ae4643929b173d715ac
|
4
|
+
data.tar.gz: b36d0dc2c464331b734dc7da5eab243154741146
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a47803fbb2325ce23dca838aa221c523cf748b01081332d15dc442a318cae53a8d19f7e362381869619e516cac1b5ae9b0036da9292bd711b9297ab7c748eb85
|
7
|
+
data.tar.gz: 9e54cf05e1cc2e50c9a5283641070be4d0d8604455f01e0248559d8e15a7972c0303b8afac06605c90ff9db6f9ced9bfed021a6e5e86eb2e4868c580689fd7e0
|
data/.gitattributes
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Auto detect text files and perform LF normalization
|
2
|
+
* text=auto
|
3
|
+
|
4
|
+
# Custom for Visual Studio
|
5
|
+
*.cs diff=csharp
|
6
|
+
|
7
|
+
# Standard to msysgit
|
8
|
+
*.doc diff=astextplain
|
9
|
+
*.DOC diff=astextplain
|
10
|
+
*.docx diff=astextplain
|
11
|
+
*.DOCX diff=astextplain
|
12
|
+
*.dot diff=astextplain
|
13
|
+
*.DOT diff=astextplain
|
14
|
+
*.pdf diff=astextplain
|
15
|
+
*.PDF diff=astextplain
|
16
|
+
*.rtf diff=astextplain
|
17
|
+
*.RTF diff=astextplain
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
aesthetify (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
minitest (5.10.2)
|
10
|
+
minitest-proveit (1.0.0)
|
11
|
+
minitest (> 5, < 7)
|
12
|
+
rake (12.0.0)
|
13
|
+
|
14
|
+
PLATFORMS
|
15
|
+
ruby
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
aesthetify!
|
19
|
+
bundler (~> 1.15)
|
20
|
+
minitest
|
21
|
+
minitest-proveit
|
22
|
+
rake
|
23
|
+
|
24
|
+
BUNDLED WITH
|
25
|
+
1.15.1
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 TheAssailant https://github.com/theassailant
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
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, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# aesthetify
|
2
|
+
|
3
|
+
aesthetify makes it simple to take any string and transform it for the
|
4
|
+
AESTHETIC. In addition, it also makes creating Fullwidth text
|
5
|
+
just as simple.
|
6
|
+
|
7
|
+
aesthetify comes with regular methods and bang versions of those methods for
|
8
|
+
in-place string modification.
|
9
|
+
|
10
|
+
## Examples
|
11
|
+
|
12
|
+
Using String#aesthetify:
|
13
|
+
```ruby
|
14
|
+
text = "vaporwave"
|
15
|
+
text.aesthetify!
|
16
|
+
puts text
|
17
|
+
#=> VAPORWAVE
|
18
|
+
```
|
19
|
+
|
20
|
+
Using String#fullwidth:
|
21
|
+
```ruby
|
22
|
+
text = "long boy"
|
23
|
+
text.fullwidth!
|
24
|
+
puts text
|
25
|
+
#=> long boy
|
26
|
+
```
|
27
|
+
|
28
|
+
Using concatenation:
|
29
|
+
```ruby
|
30
|
+
text = "This is the " + "sad boys ".aesthetify + "club"
|
31
|
+
puts text
|
32
|
+
#=> This is the SAD BOYS club
|
33
|
+
```
|
34
|
+
|
35
|
+
## License
|
36
|
+
aesthetify is released under the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require "rake/testtask"
|
4
|
+
|
5
|
+
Rake::TestTask.new do |test|
|
6
|
+
test.libs << "test"
|
7
|
+
test.libs << "lib"
|
8
|
+
test.test_files = FileList["test/**/*_test.rb"]
|
9
|
+
test.warning = false
|
10
|
+
end
|
11
|
+
|
12
|
+
task default: :test
|
data/aesthetify.gemspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = "aesthetify"
|
3
|
+
s.version = "1.0.0"
|
4
|
+
s.authors = "TheAssailant"
|
5
|
+
s.email = "TheAssailant@users.noreply.github.com"
|
6
|
+
s.summary = %q{aesthetify is a gem that lets you transform ASCII text into fullwidth text of 2 distinct flavors: regular Fullwidth and AESTHETIC}
|
7
|
+
s.homepage = "https://github.com/TheAssailant/aesthetify"
|
8
|
+
s.license = "MIT"
|
9
|
+
|
10
|
+
s.required_ruby_version = "~> 2.1"
|
11
|
+
|
12
|
+
s.add_development_dependency "bundler", "~> 1.15"
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- test/*`.split("\n")
|
16
|
+
end
|
data/lib/aesthetify.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
=begin
|
2
|
+
The basic premise is we shift characters into the Fullwidth and Halfwidth
|
3
|
+
Unicode character space using simple arithmetic and a 0x0020 (32) character
|
4
|
+
offset since the ASCII characters with fullwidth replacements only begin
|
5
|
+
showing up at 0x0021 in Unicode (0x0020 is the space character).
|
6
|
+
=end
|
7
|
+
|
8
|
+
class String
|
9
|
+
def aesthetify
|
10
|
+
output = []
|
11
|
+
self.split("").each do |letter|
|
12
|
+
# We skip lowercase letters so we can turn them uppercase for the
|
13
|
+
# aesthetify method
|
14
|
+
if (0x0021..0x0060).include?(letter.ord) || (0x007B..0x007E).include?(letter.ord)
|
15
|
+
output << (letter.ord + 0xFF00 - 32).chr(Encoding::UTF_8)
|
16
|
+
elsif (0x0061..0x007A).include?(letter.ord)
|
17
|
+
output << (letter.ord + 0xFF00 - 64).chr(Encoding::UTF_8)
|
18
|
+
else
|
19
|
+
output << letter
|
20
|
+
end
|
21
|
+
end
|
22
|
+
output.join
|
23
|
+
end
|
24
|
+
|
25
|
+
def aesthetify!
|
26
|
+
self.replace self.aesthetify
|
27
|
+
end
|
28
|
+
|
29
|
+
def fullwidth
|
30
|
+
output = []
|
31
|
+
self.split("").each do |letter|
|
32
|
+
if(0x0021..0x007E).include?(letter.ord)
|
33
|
+
output << (letter.ord + 0xFF00 - 32).chr(Encoding::UTF_8)
|
34
|
+
else
|
35
|
+
output << letter
|
36
|
+
end
|
37
|
+
end
|
38
|
+
output.join
|
39
|
+
end
|
40
|
+
|
41
|
+
def fullwidth!
|
42
|
+
self.replace self.fullwidth
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'aesthetify'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
require 'minitest/hell'
|
4
|
+
|
5
|
+
DATA1 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
|
6
|
+
DATA2 = "The quick brown fox jumps over the lazy dog."
|
7
|
+
|
8
|
+
AESTHETIFY1 = " !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~"
|
9
|
+
AESTHETIFY2 = "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG."
|
10
|
+
|
11
|
+
FULLWIDTH1 = " !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~"
|
12
|
+
FULLWIDTH2 = "The quick brown fox jumps over the lazy dog."
|
13
|
+
|
14
|
+
class AesthetifyTest < Minitest::Test
|
15
|
+
def test_aesthetify
|
16
|
+
assert_equal AESTHETIFY1, DATA1.aesthetify
|
17
|
+
assert_equal AESTHETIFY2, DATA2.aesthetify
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_aesthetify_mutation
|
21
|
+
testdata = String.new(DATA2)
|
22
|
+
testdata.aesthetify!
|
23
|
+
assert_equal AESTHETIFY2, testdata
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_fullwidth
|
27
|
+
assert_equal FULLWIDTH1, DATA1.fullwidth
|
28
|
+
assert_equal FULLWIDTH2, DATA2.fullwidth
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_fullwidth_mutation
|
32
|
+
testdata = String.new(DATA2)
|
33
|
+
testdata.fullwidth!
|
34
|
+
assert_equal FULLWIDTH2, testdata
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aesthetify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- TheAssailant
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-07-10 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.15'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.15'
|
27
|
+
description:
|
28
|
+
email: TheAssailant@users.noreply.github.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- ".gitattributes"
|
34
|
+
- Gemfile
|
35
|
+
- Gemfile.lock
|
36
|
+
- LICENSE
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- aesthetify.gemspec
|
40
|
+
- lib/aesthetify.rb
|
41
|
+
- test/aesthetify_test.rb
|
42
|
+
homepage: https://github.com/TheAssailant/aesthetify
|
43
|
+
licenses:
|
44
|
+
- MIT
|
45
|
+
metadata: {}
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.1'
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 2.5.2
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: "aesthetify is a gem that lets you transform ASCII text into fullwidth text
|
66
|
+
of 2 distinct flavors: regular \uFEFFFullwidth and AESTHETIC"
|
67
|
+
test_files:
|
68
|
+
- test/aesthetify_test.rb
|