kali 0.0.1 → 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.
- data/.gitignore +1 -0
- data/kali.gemspec +19 -0
- data/lib/kali/type/date_time.rb +2 -0
- data/lib/kali/utils/text.rb +2 -2
- data/lib/kali/version.rb +1 -1
- data/test/type_test.rb +1 -0
- metadata +3 -1
data/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.gem
|
data/kali.gemspec
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
+
require "kali/version"
|
|
6
|
+
require "date"
|
|
7
|
+
|
|
8
|
+
Gem::Specification.new do |spec|
|
|
9
|
+
spec.name = "kali"
|
|
10
|
+
spec.version = Kali::VERSION
|
|
11
|
+
spec.date = Date.today
|
|
12
|
+
spec.summary = "Implementation of the iCalendar standard"
|
|
13
|
+
spec.description = "Extensible implementation of RFC5545. Also known as 'iCalendar'"
|
|
14
|
+
spec.authors = ["Nicolas Sanguinetti"]
|
|
15
|
+
spec.email = ["hi@nicolassanguinetti.info"]
|
|
16
|
+
spec.homepage = "https://github.com/foca/kali"
|
|
17
|
+
spec.files = `git ls-files`.split("\n")
|
|
18
|
+
spec.platform = Gem::Platform::RUBY
|
|
19
|
+
end
|
data/lib/kali/type/date_time.rb
CHANGED
|
@@ -23,6 +23,8 @@ module Kali
|
|
|
23
23
|
def detect_timezone(date_time)
|
|
24
24
|
offset = date_time.to_datetime.zone
|
|
25
25
|
sign, hour, minute = offset.scan(/(\+|-)(\d{2}):(\d{2})/).flatten
|
|
26
|
+
hour.gsub!(/^0/, "")
|
|
27
|
+
minute.gsub!(/^0/, "")
|
|
26
28
|
offset = Integer("#{sign}1") * (60 * Integer(minute) + 3600 * Integer(hour))
|
|
27
29
|
|
|
28
30
|
if offset.zero?
|
data/lib/kali/utils/text.rb
CHANGED
|
@@ -17,7 +17,7 @@ module Kali
|
|
|
17
17
|
tail &&= tail.scan(/.{0,74}/)
|
|
18
18
|
.reject { |fragment| fragment.nil? || fragment.empty? }
|
|
19
19
|
.map { |fragment| " #{fragment}" }
|
|
20
|
-
[head, *tail].join("\
|
|
20
|
+
[head, *tail].join("\n")
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
# Public: Collapse a folded line into a single line without line breaks. See
|
|
@@ -33,7 +33,7 @@ module Kali
|
|
|
33
33
|
#
|
|
34
34
|
# Returns a String.
|
|
35
35
|
def unfold_line(lines)
|
|
36
|
-
head, *tail = lines.split("\
|
|
36
|
+
head, *tail = lines.split("\n")
|
|
37
37
|
tail.map! { |line| line[1..-1] }
|
|
38
38
|
[head, *tail].join("")
|
|
39
39
|
end
|
data/lib/kali/version.rb
CHANGED
data/test/type_test.rb
CHANGED
|
@@ -106,6 +106,7 @@ class TypeTest < MiniTest::Unit::TestCase
|
|
|
106
106
|
def test_date_time
|
|
107
107
|
type = Kali::Type::DateTime.new
|
|
108
108
|
assert_equal "20130731T103000", type.encode(DateTime.parse("2013-07-31 10:30:00 +02:00"))
|
|
109
|
+
assert_equal "20130731T103000", type.encode(DateTime.parse("2013-07-31 10:30:00 +09:00"))
|
|
109
110
|
assert_equal DateTime.parse("1985-03-27 20:23:15"), type.decode("19850327T202315")
|
|
110
111
|
|
|
111
112
|
assert_equal "20130731T103000Z", type.encode(DateTime.parse("2013-07-31 10:30:00 UTC"))
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kali
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -18,8 +18,10 @@ executables: []
|
|
|
18
18
|
extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
|
20
20
|
files:
|
|
21
|
+
- .gitignore
|
|
21
22
|
- README.md
|
|
22
23
|
- examples/calendar.rb
|
|
24
|
+
- kali.gemspec
|
|
23
25
|
- lib/kali.rb
|
|
24
26
|
- lib/kali/component.rb
|
|
25
27
|
- lib/kali/component/calendar.rb
|