pictureframe 0.0.6 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pictureframe/version.rb +1 -1
- data/lib/pictureframe.rb +20 -4
- metadata +2 -4
- data/pictureframe-0.0.1.gem +0 -0
- data/pictureframe-0.0.2.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b0d5f6e631e764e52b54242e1e0beeeb9836945
|
4
|
+
data.tar.gz: 4aa40e50a350c31a896f056d7c182c18c429c5f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9693803f8566fffbcc72b8b5c82ca71a02a86032ae6c27ba0c0168845243a20234d12726c10fbc28bc9d7af41bb1343af81302f7f2004e7a1d52cf8781b38a24
|
7
|
+
data.tar.gz: fb3cd3a8e4c0b528de2cf5c5de38d071dbbdeefa2d99efdf869d42796f7fb494d6281c6cfe4b72d2a8d3e0484b0658e447fc4fad7fa01bc99bd8d59ff5f9fefa
|
data/lib/pictureframe/version.rb
CHANGED
data/lib/pictureframe.rb
CHANGED
@@ -1,22 +1,38 @@
|
|
1
1
|
require "pictureframe/version"
|
2
2
|
|
3
3
|
module Pictureframe
|
4
|
-
def self.frame(text, width =
|
4
|
+
def self.frame(text, width = nil)
|
5
5
|
inputLocation = 3
|
6
6
|
output = []
|
7
7
|
lefts = [".___", "| ._", "| | ", "| ._", "|___"]
|
8
8
|
rights = ["___.", "_. |", " | |", "_. |", "___|"]
|
9
|
-
|
10
|
-
|
9
|
+
insideLines = [text]
|
10
|
+
|
11
|
+
if width
|
12
|
+
textSpace = width - (lefts[0].length * 2)
|
13
|
+
insideLines = textSpace < text.length ? breakText(text, textSpace) : [text]
|
14
|
+
else
|
15
|
+
totalLength = lefts[0].length + rights[0].length + text.length
|
16
|
+
width = totalLength if totalLength > width
|
17
|
+
end
|
18
|
+
|
11
19
|
lefts.each_with_index do |row, i|
|
12
20
|
filler = i == 2 ? " " : "_"
|
13
21
|
output[i] = expandLine(lefts[i], rights[i], filler, width)
|
14
22
|
end
|
15
|
-
|
23
|
+
|
24
|
+
insideLines.reverse.each do |text|
|
25
|
+
output = output.insert(inputLocation, expandLine("| | ", " | |", " ", width, text))
|
26
|
+
end
|
27
|
+
|
16
28
|
puts output.join("\n")
|
17
29
|
return output
|
18
30
|
end
|
19
31
|
|
32
|
+
def self.breakText(string, numChars)
|
33
|
+
string.scan(/#{'.{1,' + numChars.to_s}}/)
|
34
|
+
end
|
35
|
+
|
20
36
|
def self.expandLine(left, right, filler, width, text = "")
|
21
37
|
totalLength = left.length + right.length + text.length
|
22
38
|
width = totalLength if totalLength > width
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pictureframe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Palmer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,8 +84,6 @@ files:
|
|
84
84
|
- bin/setup
|
85
85
|
- lib/pictureframe.rb
|
86
86
|
- lib/pictureframe/version.rb
|
87
|
-
- pictureframe-0.0.1.gem
|
88
|
-
- pictureframe-0.0.2.gem
|
89
87
|
- pictureframe.gemspec
|
90
88
|
homepage: http://www.github.com/cdpalmer
|
91
89
|
licenses:
|
data/pictureframe-0.0.1.gem
DELETED
Binary file
|
data/pictureframe-0.0.2.gem
DELETED
Binary file
|