reciter 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,11 @@ An alternative text can be provided for replacing "to":
30
30
  p.unparse(1, 2, 3) # "1 a 3"
31
31
 
32
32
 
33
+ It's possible unparsing to "mechanical" form:
34
+
35
+ p.unparse(:mechanic, 1, 2, 3, 5, 9, 10, 11) # 1-3;5;9-11
36
+
37
+
33
38
  == How to install
34
39
 
35
40
  Just run:
@@ -51,12 +51,16 @@ module Reciter
51
51
 
52
52
  def handle_unparse_params(params)
53
53
  if params[0].is_a? Symbol
54
- [params[0] == :mechanic, params[1..-1]]
54
+ [params[0] == :mechanic, handle_unparse_params_list(params[1..-1])]
55
55
  else
56
- [false, params]
56
+ [false, handle_unparse_params_list(params)]
57
57
  end
58
58
  end
59
59
 
60
+ def handle_unparse_params_list(list)
61
+ list[0].is_a?(Array) ? list[0] : list
62
+ end
63
+
60
64
  def validate_format(sequence)
61
65
  subsequences = sequence.split(';')
62
66
  raise InvalidInput unless !subsequences.empty? &&
@@ -1,3 +1,3 @@
1
1
  module Reciter
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reciter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: