ss2json 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog CHANGED
@@ -1,10 +1,15 @@
1
+ 2012-05-24 Guillermo Alvarez <guillermo@cientifico.net>
2
+
3
+ * cli.rb (initi_document) : If you specify an invalid sheets, the message
4
+ right now is cleaner and showing the list of available spreadsheets.
5
+ * row_converter.rb (sanitize_key) : [bug] sanitify_key fail if the key is
6
+ just one letter. Now it is fixed.
7
+
1
8
  2012-05-23 Guillermo Alvarez <guillermo@cientifico.net>
2
9
 
3
10
  * row_converter.rb (sanitize_key) : Added the option to downcase the first
4
11
  letter
5
12
 
6
-
7
-
8
13
  2012-05-16 Guillermo Alvarez Fernandez <guillermo@cientifico.net>
9
14
 
10
15
  * all : Initial import
data/lib/ss2json/cli.rb CHANGED
@@ -42,7 +42,12 @@ class Ss2Json
42
42
 
43
43
  def init_document
44
44
  @doc = open
45
+ begin
45
46
  @doc.default_sheet = @options[:sheet] if @options[:sheet]
47
+ rescue RangeError => e
48
+ raise if @doc.sheets.include?(@options[:sheet])
49
+ raise "\nThe sheet #{@options[:sheet]} did not exists. The available sheets are:\n" + @doc.sheets.map{|s| "\t* #{s}\n"}.join("")
50
+ end
46
51
  @doc.header_line = @options[:first_row] if @options[:first_row]
47
52
  end
48
53
 
@@ -46,8 +46,8 @@ class Ss2Json
46
46
  end
47
47
 
48
48
  def sanitize_key(key)
49
- return key unless is_valid_key?(key)
50
- key = key[0..1].downcase + key[2..-1] if @options[:downcase_first_letter]
49
+ return key unless is_valid_key?(key) && key.is_a?(String)
50
+ key = key[0..1].downcase + (key[2..-1] || "") if @options[:downcase_first_letter]
51
51
  key
52
52
  end
53
53
 
@@ -1,3 +1,3 @@
1
1
  class Ss2json
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ss2json
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Guillermo A\xCC\x81lvarez"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-23 00:00:00 +00:00
18
+ date: 2012-05-24 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency