llamascii 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +22 -0
- data/bin/llamascii +5 -0
- data/lib/llamascii.rb +3 -0
- data/lib/llamascii/drawer.rb +61 -0
- data/lib/llamascii/version.rb +3 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f190859cb5277b64317ba81be5e4a7b3e9fd3f1b
|
4
|
+
data.tar.gz: 6f9a69f3d11d76155d3a0794a1c73a30d1974b4a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6113ca982d918c4b5b64f87d199d673d0668e1ece11b3e99cb732ba5703391a933b23b6c5d8adf68d0e981e91257dcf378229fd58493db1cc0a1b53388951b38
|
7
|
+
data.tar.gz: f8e4d49aa7851273061a783dcb7aae4ea5ac4942cfd98693ce78d846603c1dfcd85bfc7e37f36b71f6ceee281ccf1440a7774d9a63e1fe7e56cb046ee3e35b6c
|
data/README.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# Llamascii
|
2
|
+
|
3
|
+
## Install
|
4
|
+
|
5
|
+
`gem install llamascii`
|
6
|
+
|
7
|
+
## Use
|
8
|
+
|
9
|
+
Open up a terminal, and type:
|
10
|
+
|
11
|
+
`llamascii "llamas are great"`
|
12
|
+
|
13
|
+
and you'll get
|
14
|
+
|
15
|
+
```
|
16
|
+
,
|
17
|
+
~)
|
18
|
+
(_---;
|
19
|
+
/|~|\
|
20
|
+
/ / /|
|
21
|
+
| llamas are great |
|
22
|
+
```
|
data/bin/llamascii
ADDED
data/lib/llamascii.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'action_view'
|
2
|
+
|
3
|
+
module Llamascii
|
4
|
+
class Drawer
|
5
|
+
include ActionView::Helpers::TextHelper
|
6
|
+
|
7
|
+
attr_reader :message
|
8
|
+
MAX_LINE_LENGTH = 20
|
9
|
+
|
10
|
+
def initialize(message = "")
|
11
|
+
@message = message
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.draw(message)
|
15
|
+
d = Drawer.new(message)
|
16
|
+
output = ""
|
17
|
+
output << d.draw_llama
|
18
|
+
output << d.draw_message
|
19
|
+
end
|
20
|
+
|
21
|
+
def draw_llama
|
22
|
+
base_llama
|
23
|
+
end
|
24
|
+
|
25
|
+
def draw_message
|
26
|
+
return "" if message.nil? || message.empty?
|
27
|
+
|
28
|
+
"".tap do |o|
|
29
|
+
#o << "-".center(MAX_LINE_LENGTH+5, '-')
|
30
|
+
#o << "\n"
|
31
|
+
o << formatted_message
|
32
|
+
#o << "\n"
|
33
|
+
#o << "-".center(MAX_LINE_LENGTH+5, '-')
|
34
|
+
#o << "\n"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
def formatted_message
|
41
|
+
msg = message.gsub("\n", "").gsub("\r", "")
|
42
|
+
# split after x words, when x+1 words is > MAX_LINE_LENGTH
|
43
|
+
msg = word_wrap(msg, line_width: MAX_LINE_LENGTH + 5)
|
44
|
+
centered = ""
|
45
|
+
msg.split("\n").each do |line|
|
46
|
+
centered << '|' << line.center(MAX_LINE_LENGTH + 5, ' ') << "|\n"
|
47
|
+
end.join("")
|
48
|
+
centered
|
49
|
+
end
|
50
|
+
|
51
|
+
def base_llama
|
52
|
+
<<-LLAMA
|
53
|
+
,
|
54
|
+
~)
|
55
|
+
(_---;
|
56
|
+
/|~|\\
|
57
|
+
/ / /|
|
58
|
+
LLAMA
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: llamascii
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.2'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Carl Furrow
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: actionview
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.1.0
|
27
|
+
description: Do llamas, add ascii
|
28
|
+
email: me@carlfurrow.com
|
29
|
+
executables:
|
30
|
+
- llamascii
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- README.md
|
35
|
+
- bin/llamascii
|
36
|
+
- lib/llamascii.rb
|
37
|
+
- lib/llamascii/drawer.rb
|
38
|
+
- lib/llamascii/version.rb
|
39
|
+
homepage: http://carlfurrow.com
|
40
|
+
licenses:
|
41
|
+
- MIT
|
42
|
+
metadata: {}
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - '>='
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: '0'
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 2.4.1
|
60
|
+
signing_key:
|
61
|
+
specification_version: 4
|
62
|
+
summary: Llamascii
|
63
|
+
test_files: []
|
64
|
+
has_rdoc:
|