mysh 0.2.4 → 0.2.5

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: 9c8cc767a514a9a668026f2f0006b505b04a385c
4
- data.tar.gz: 5b7e0582cb48cafca86b8c12f054678b7077122b
3
+ metadata.gz: 9696599d94ed469efdc12d988e1fca5e033f5126
4
+ data.tar.gz: bd16dac7ecb6b576fc009334f0f326c97eb7be8c
5
5
  SHA512:
6
- metadata.gz: 0b52c0e5e4bf9925bc25f7529f5506c6c788222a0e1a0d51cf6e1adc72b72ca24c6e5c88eb19b478a4135be71f6e7eea03620c21bde4f1464a51fb6192eaf921
7
- data.tar.gz: c9f0dbc3e0b07dfde1234817b6aaecc8f6a81736572eb14a5868f6fa85c31aab26f17c7ed3b655777eb8b69eee981e0058d89db46b6c44cfe04a52ee581ed4a8
6
+ metadata.gz: 6b5dd1d00c374dfdb3b482a518d8f3bdb8a7b3754e6b31efc05e02e178cef3db0d2eb1dd62da90098a3fef819a98c17f56e025a65d4cfac346aeab330f098d5e
7
+ data.tar.gz: 717a6190bff1dd180906d447d440efeee689fbd425fde050a2bc556036a7644f71a977d0308b29337ebeb31dbe1a1b917a06664d68aad217b714a08dd0375626
@@ -45,8 +45,8 @@ class Array
45
45
  # Bullets ========================================================
46
46
 
47
47
  #Print out the array as bullet points.
48
- def puts_mysh_bullets
49
- puts mysh_bulletize
48
+ def puts_mysh_bullets(page_width = Mysh::PAGE_WIDTH)
49
+ puts mysh_bulletize(page_width)
50
50
  end
51
51
 
52
52
  #Convert the array to strings with bullet points.
@@ -59,10 +59,19 @@ class Array
59
59
 
60
60
  builder = Mysh::BulletPoints.new(page_width)
61
61
 
62
- each {|pair| builder.add(*pair)}
62
+ each {|pair| builder.add(*pair.prepare_bullet_data)}
63
63
 
64
64
  builder.render.join("\n")
65
65
  end
66
66
 
67
+ #Get data ready for being in a bullet point.
68
+ def prepare_bullet_data
69
+ if length < 2
70
+ ["*", self[0]]
71
+ else
72
+ self
73
+ end
74
+ end
75
+
67
76
  end
68
77
 
@@ -8,6 +8,11 @@ class Object
8
8
  self.to_s.format_description(max_width)
9
9
  end
10
10
 
11
+ #Get data ready for being in a bullet point.
12
+ def prepare_bullet_data
13
+ ["*", self]
14
+ end
15
+
11
16
  end
12
17
 
13
18
 
data/lib/mysh/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Mysh
4
4
  #The version string of MY SHell.
5
- VERSION = "0.2.4"
5
+ VERSION = "0.2.5"
6
6
 
7
7
  #A brief summary of this gem.
8
8
  SUMMARY = "mysh -- a Ruby inspired command line shell."
@@ -118,6 +118,10 @@ class MyShellTester < Minitest::Test
118
118
 
119
119
  assert_equal("", [].mysh_bulletize)
120
120
 
121
+ data = ["apple", "cherry", "victory"]
122
+ result = "* apple\n* cherry\n* victory"
123
+ assert_equal(result, data.mysh_bulletize)
124
+
121
125
  end
122
126
 
123
127
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Camilleri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-29 00:00:00.000000000 Z
11
+ date: 2016-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler