humble_rpi-plugin-mtp 0.3.0 → 0.3.1

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: f61b0bab3ec684e828addf015ceb6aae0349fe07
4
- data.tar.gz: 67f376eeab20431965371feb205ccff50ae4d48b
3
+ metadata.gz: dc34ff77abbc00b535a8babb99386074208d1495
4
+ data.tar.gz: bf3c2cce181843d6ddad126157319a7e6229b06c
5
5
  SHA512:
6
- metadata.gz: 7b86db51cf90d54cde58c8f9b66f2f1985af88fcd1ea39693ddd51c0bef1659654027fca2cf25cebda51881e57af3682dc13c9986d4a4d61126a664270760586
7
- data.tar.gz: 61f549c93567bbb3f12f7c86bf09fac209b415dc2b605d966666d4a8886eb527ffb047b70a82aed4bb45aee3a3adf708c692be0907e0e3c282c0df0947537cc9
6
+ metadata.gz: c2e867ef5c9c3aff5036b3493d511fa0e1c6f1462ad6fd6e4e306f45e0474dffbcefed64d5e30c9ec7a3edb9aab0b001fa3bf5d774e54ae29b8c8294c3e61ff4
7
+ data.tar.gz: a7c92703fd2448ef1c15bdce3ee012c3050f43a18cb369cfdc2df9728fccc51f6a9df5d70b3e08476137e3e69b02eaf7a9c7ee3a7741d40f0a667a94a530962b
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -17,6 +17,8 @@ class Html < DomRender
17
17
  def b(x)
18
18
  [:bold_on, render_all(x), :bold_off]
19
19
  end
20
+
21
+ alias strong b
20
22
 
21
23
  end
22
24
 
@@ -50,7 +52,7 @@ class HumbleRPiPluginMTP < SerialPortMTP
50
52
  if message =~ /^</ then
51
53
  scanprint Html.new(message).to_a
52
54
  else
53
- message.lines {|x| self.print x}
55
+ wordwrap(message).lines {|x| self.print x}
54
56
  end
55
57
  feed 4
56
58
 
@@ -79,7 +81,7 @@ class HumbleRPiPluginMTP < SerialPortMTP
79
81
  a2.each do |x|
80
82
 
81
83
  if x.is_a? String then
82
- print x
84
+ self.print wordwrap(x).lines
83
85
  elsif x.is_a? Array
84
86
  scanprint x
85
87
  else
@@ -90,5 +92,29 @@ class HumbleRPiPluginMTP < SerialPortMTP
90
92
 
91
93
  end
92
94
 
95
+ def wordwrap(s, cols=32)
96
+
97
+ a = s.split(/ /)
98
+
99
+ a2 = a.inject(['']) do |r,word|
100
+
101
+ word.lines.each do |x|
102
+
103
+ if (r[-1] + x).length <= cols then
104
+ r[-1] << (r[-1].empty? ? x : ' ' + x)
105
+ else
106
+ r += [x]
107
+ end
108
+ r[-1] = r[-1].chomp ; r += [''] if x[-1] == "\n"
109
+
110
+ end
111
+ r
112
+ end
113
+
114
+ a2.join("\n")
115
+
116
+ end
117
+
118
+
93
119
 
94
120
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: humble_rpi-plugin-mtp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  07Qsn8/aUhItdv3jAFZhDZ0Je1h0BeZoQQygHJrJDg7K0lFZXkWE/fJqdoPgKdPv
32
32
  KcCsTt7owyec9w==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-11-09 00:00:00.000000000 Z
34
+ date: 2015-11-10 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: serialport_mtp
metadata.gz.sig CHANGED
Binary file