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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b5295689982057067b2d105836845db0ddf208c
4
- data.tar.gz: 2c016d9e0eb4dcf2147a04e19819fba64cc11db1
3
+ metadata.gz: 75278537afc8730dce30913aa878704e2031346c
4
+ data.tar.gz: 498e3e5224ede8b84219727027f947dfe23804d8
5
5
  SHA512:
6
- metadata.gz: 137d5afba5169f9bd2b5203693b2befc9c15101b6b7dc857a392b6553ef201e091121e129cba4fb091961f0085872fdd697a1085c961787893c09cd9e7a80652
7
- data.tar.gz: 8f432d67d9e20305af64ab186a767cf940f373dc83e06e77e6f2209f3df5ae1d5202b975519603c99106d0625430e628fe740a703e180f9b39ddba55c4d3252d
6
+ metadata.gz: 04260cd3a40434eb73e8f4e7bc204eb36c45e715195c8a7365f795d12f0441ac14636f14c0a434337e421c8c6491d18f0e3603ea314761f3d15bf4de447c063a
7
+ data.tar.gz: 316b1347496462a8b1b8aaa2da9d71355b26c8124c00427e0a25e68cd3ecae77eadd30d8ccc6ad6b6aea6fef118c04bf000bff4c90800e6fce567fcc749f7075
@@ -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
- left = "| | "
12
- right = " | |"
13
- totalLength = left.length + right.length + text.length
14
- numChars = width - totalLength
15
- output = [".____.",
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
- numSpaces = width - totalLength
28
- return "break up text" if totalLength > width
29
- return left + text + " "*numSpaces + right
27
+ numFiller = width - totalLength
28
+ left + text + filler*numFiller + right
30
29
  end
31
30
  end
@@ -1,3 +1,3 @@
1
1
  module Pictureframe
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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.1
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: