commentbox 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/commentbox.rb +6 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 922e9531c4f2d9e403c9343697e58086c40217a625de7b66b8b145c619b8eae9
|
4
|
+
data.tar.gz: 6d4ba601200f5fef70d43203dbc4e2ae4cd76d105c5e884cef96fccee26627ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f862760a55925ce00d08746251bc8512189e0acd301e6bb4c45d84cc42115da0fd97eb64eb508429ef959021c48e14361ddafe0e24e6ece5d9d9e09a776d4667
|
7
|
+
data.tar.gz: 9eed5ab62484e8acefad8dccc13ddd843555adcac89eb6cc37a23bbd4cf06f3ae760475e75f498ce3b678ea7291ea79e67ad46310d164824947b7d5857d10df9
|
data/lib/commentbox.rb
CHANGED
@@ -144,11 +144,14 @@ private
|
|
144
144
|
@alignment = [ align ] * (@text.size)
|
145
145
|
# set @alignment directly if an array is given
|
146
146
|
elsif align.is_a? Array
|
147
|
+
align.map! { |a| a.to_sym }
|
147
148
|
# if the array is too short, fill it with the last element
|
148
149
|
if align.size < @text.size then (@text.size - align.size).times { align.push align.last } end
|
149
150
|
@alignment = align
|
151
|
+
elsif align.is_a? String
|
152
|
+
@alignment = [ align.to_sym ] * (@text.size)
|
150
153
|
else
|
151
|
-
raise 'CommentBox#alignment= : expected Symbol or
|
154
|
+
raise 'CommentBox#alignment= : expected Symbol, Array, or String here'
|
152
155
|
end
|
153
156
|
end
|
154
157
|
# if the number of lines is even, insert a blank line between the first and second lines
|
@@ -158,7 +161,8 @@ private
|
|
158
161
|
if style == nil then @style = Styles[DefaultParams[:style]]
|
159
162
|
elsif style.is_a? Symbol then @style = Styles[style]
|
160
163
|
elsif style.is_a? Hash then @style = style
|
161
|
-
|
164
|
+
elsif style.is_a? String then @style = Styles[style.to_sym]
|
165
|
+
else raise 'CommentBox#style= : expected Symbol, Hash, or String here' end
|
162
166
|
end
|
163
167
|
def insert_line_if_even # also will delete a blank line if there is one
|
164
168
|
# stop this function from raising errors we don't really care about if the instance isn't fully constructed yet
|