conflict-calendars 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +30 -4
- data/lib/conflict/calendars/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c7afb4ee02482c198e8363c8af48f6308770b4f
|
4
|
+
data.tar.gz: 1b126180c369001438dc04657d034f37e1bbd32f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0aaf2dfd45334b53623f76549574639d903c90f9561f57eeff8a100f360182c5c17fb844ed218880671516734ad33cf020e2689d344048c60ae062010ae4f99
|
7
|
+
data.tar.gz: '090837b0584785249bd554fda7c0c7ddf814882ca98ba27881bb1384a55d7b52c31da1381ab00dca138a34eccba9a8aa3103c8b4028263944ab24b1306eb52f8'
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Conflict::Calendars
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
The gem help you find the conflict-calendars from calendars
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -22,8 +20,36 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
First you should create Ccs::Calendar object by this way
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
calendar_A = Ccs::Calendar.new("enter the name of calendar",Time.new(2016,12,10,8,0),Time.new(2016,12,10,13,0)
|
27
|
+
#=> #<Ccs::Calendar:0x007f9892be85e8 @name="enter the name of calendar", @start_time=2016-12-10 08:00:00 +0800, @end_time=2016-12-10 13:00:00 +0800>
|
28
|
+
```
|
29
|
+
```ruby
|
30
|
+
calendar_B = Ccs::Calendar.new(Time.new(2016,12,10,9,0),Time.new(2016,12,10,10,30))
|
31
|
+
#=> #<Ccs::Calendar:0x007fa36c55bf38 @name=nil, @start_time=2016-12-10 09:00:00 +0800, @end_time=2016-12-10 10:30:00 +0800>
|
32
|
+
```
|
33
|
+
And then you can find the conflicts by this way
|
26
34
|
|
35
|
+
```ruby
|
36
|
+
conflicts = Ccs::Conflicts.new(calendar_A,calendar_B)
|
37
|
+
conflicts.size #=> 1
|
38
|
+
conflicts.each do |conflict|
|
39
|
+
p conflict #=> #<Set: {#<Ccs::Calendar:0x007fb..>, #<Ccs::Calendar:0x007fc..>} >
|
40
|
+
end
|
41
|
+
```
|
42
|
+
Now, you can know there are exist two calendars that conflict in the same set.
|
43
|
+
So, you can do that :
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
conflict.each do |calendar|
|
47
|
+
p calendar #=> #<Ccs::Calendar:0x007fb..>
|
48
|
+
p calendar.name #=> "enter the name of calendar"
|
49
|
+
p calendar.start_time #=> "2016-12-10 08:00:00 +0800"
|
50
|
+
p calendar.end_time #=> "2016-12-10 13:00:00 +0800"
|
51
|
+
end
|
52
|
+
```
|
27
53
|
## Development
|
28
54
|
|
29
55
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|