simplevcf 0.0.2 → 0.0.3

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.
Files changed (2) hide show
  1. data/lib/simplevcf.rb +8 -6
  2. metadata +2 -2
data/lib/simplevcf.rb CHANGED
@@ -4,21 +4,23 @@ class SimpleVCF
4
4
  end
5
5
  def parse
6
6
  @fields = Hash.new()
7
- @file_contents["BEGIN:VCARD\n"] = ""
8
- @file_contents["\nEND:VCARD"] = ""
7
+ @file_contents["BEGIN:VCARD"] = ""
8
+ @file_contents["END:VCARD"] = ""
9
9
  @lines = @file_contents.split("\n")
10
10
  for i in 0..(@lines.length-1) do
11
+ if @lines[i].include? "\r"
12
+ @lines[i]["\r"] = ""
13
+ end
11
14
  x = @lines[i]
12
15
  unless x == "" or x.nil?
13
16
  y = x.split(":")
17
+ field_name = y[0]
18
+ field_value = y[1]
19
+ @fields[field_name] = field_value
14
20
  end
15
- field_name = y[0]
16
- field_value = y[1]
17
- @fields[field_name] = field_value
18
21
  end
19
22
  end
20
23
  def output
21
24
  return @fields
22
25
  end
23
26
  end
24
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplevcf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-19 00:00:00.000000000 Z
12
+ date: 2012-11-21 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Imports a .vcf file and parses contents into a hash.
15
15
  email: bartoszpietraszko@gmail.com