pictureframe 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pictureframe.rb +16 -17
- data/lib/pictureframe/version.rb +1 -1
- data/pictureframe-0.0.1.gem +0 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75278537afc8730dce30913aa878704e2031346c
|
4
|
+
data.tar.gz: 498e3e5224ede8b84219727027f947dfe23804d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04260cd3a40434eb73e8f4e7bc204eb36c45e715195c8a7365f795d12f0441ac14636f14c0a434337e421c8c6491d18f0e3603ea314761f3d15bf4de447c063a
|
7
|
+
data.tar.gz: 316b1347496462a8b1b8aaa2da9d71355b26c8124c00427e0a25e68cd3ecae77eadd30d8ccc6ad6b6aea6fef118c04bf000bff4c90800e6fce567fcc749f7075
|
data/lib/pictureframe.rb
CHANGED
@@ -1,31 +1,30 @@
|
|
1
1
|
require "pictureframe/version"
|
2
2
|
|
3
3
|
module Pictureframe
|
4
|
-
# def initialize(logger, width = 50)
|
5
|
-
# # @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
6
|
-
# # @width = width
|
7
|
-
# end
|
8
|
-
|
9
4
|
def self.frame(text, width = 25)
|
5
|
+
# this all should be passed into a buildFrame() function
|
10
6
|
inputLocation = 3
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
"| .. |",
|
19
|
-
"|____|"]
|
7
|
+
output = []
|
8
|
+
lefts = [".__", "| .", "| |", "| .", "|__"]
|
9
|
+
rights = ["__.", ". |", "| |", ". |", "__|"]
|
10
|
+
lefts.each_with_index do |row, i|
|
11
|
+
filler = i == 2 ? " " : "_"
|
12
|
+
output[i] = expandLine(lefts[i], rights[i], filler, width)
|
13
|
+
end
|
20
14
|
output = output.insert(inputLocation, frameWrap(text, width))
|
15
|
+
puts output.join("\n")
|
16
|
+
return output
|
21
17
|
end
|
22
18
|
|
23
19
|
def self.frameWrap(text, width = 75)
|
24
20
|
left = "| | "
|
25
21
|
right = " | |"
|
22
|
+
expandLine(left, right, " ", width, text)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.expandLine(left, right, filler, width, text = "")
|
26
26
|
totalLength = left.length + right.length + text.length
|
27
|
-
|
28
|
-
|
29
|
-
return left + text + " "*numSpaces + right
|
27
|
+
numFiller = width - totalLength
|
28
|
+
left + text + filler*numFiller + right
|
30
29
|
end
|
31
30
|
end
|
data/lib/pictureframe/version.rb
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Palmer
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- bin/setup
|
86
86
|
- lib/pictureframe.rb
|
87
87
|
- lib/pictureframe/version.rb
|
88
|
+
- pictureframe-0.0.1.gem
|
88
89
|
- pictureframe.gemspec
|
89
90
|
homepage: http://www.github.com/cdpalmer
|
90
91
|
licenses:
|