jscalendar 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +48 -4
- data/lib/jscalendar/calendar.rb +3 -1
- data/lib/jscalendar/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9d29bdac386dada64770464be1ac5930d27f8ce7775abe993548d9ae102847af
|
|
4
|
+
data.tar.gz: e4236e4b51a48ad96eae416bcf0cbb707051bee34d73d69d73d27fb0d5e5dbf0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 70f9259f472edccf51467a34944c35d38b479d97148b070f8ff3dec1424dc8814909bf42976774d7c9bb6a4d6b03a9a6261915b60c1c10fad9da43561b3ab66d
|
|
7
|
+
data.tar.gz: 96d52c03f2787990e3ac9cdca33ed454926f40f5f7af7fd534f37ec506f2df95eacf01f1f7ac56ae43866223164502f88c3b073f6ff17d25a4fbf2d1f177ee81
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -1,7 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">JSCalendar</h1>
|
|
2
|
+
|
|
3
|
+
<p align="center">JSON calendars with typed models, time zones, and recurrence.</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://rubygems.org/gems/jscalendar"><img src="https://img.shields.io/gem/v/jscalendar" alt="Gem version"></a>
|
|
7
|
+
<a href="https://github.com/ydah/jscalendar/actions/workflows/main.yml"><img src="https://github.com/ydah/jscalendar/actions/workflows/main.yml/badge.svg?branch=main" alt="CI"></a>
|
|
8
|
+
<a href="https://www.ruby-lang.org/"><img src="https://img.shields.io/badge/Ruby-%3E%3D%203.3-CC342D?logo=ruby&logoColor=white" alt="Ruby 3.3 or later"></a>
|
|
9
|
+
<a href="LICENSE.txt"><img src="https://img.shields.io/badge/license-MIT-blue" alt="MIT License"></a>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="#installation">Installation</a> ·
|
|
14
|
+
<a href="#quick-start">Quick start</a> ·
|
|
15
|
+
<a href="#scope">Scope</a> ·
|
|
16
|
+
<a href="#development">Development</a> ·
|
|
17
|
+
<a href="#license">License</a>
|
|
18
|
+
</p>
|
|
2
19
|
|
|
3
20
|
Read, validate, build and expand calendar events and tasks using [RFC 8984](https://www.rfc-editor.org/rfc/rfc8984).
|
|
4
21
|
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- Build typed events, tasks, and groups while preserving extension fields.
|
|
25
|
+
- Expand Gregorian recurrence with time zones, exclusions, and overrides.
|
|
26
|
+
- Apply validated patches and localizations with configurable resource limits.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
Add the gem to your Gemfile:
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
gem "jscalendar"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then run `bundle install`.
|
|
37
|
+
|
|
38
|
+
Ruby 3.3 or newer is required. CI checks maintained CRuby versions, Ruby head, JRuby and TruffleRuby on Linux and macOS, and json 2 and 3. Runtime dependencies are `json` and `tzinfo`. Gregorian recurrence generation is implemented by this library. Install `tzinfo-data` on systems without a zoneinfo database, including Windows. No other Gem from this format family is required.
|
|
39
|
+
|
|
40
|
+
## Quick start
|
|
41
|
+
|
|
5
42
|
```ruby
|
|
6
43
|
require "jscalendar"
|
|
7
44
|
|
|
@@ -22,8 +59,6 @@ instances.each { |instance| puts [instance.recurrence_id, instance.start_time, i
|
|
|
22
59
|
instances.truncated?
|
|
23
60
|
```
|
|
24
61
|
|
|
25
|
-
Install with `gem install jscalendar`. Ruby 3.3 or newer is required. CI checks maintained CRuby versions, Ruby head, JRuby and TruffleRuby on Linux and macOS, and json 2 and 3. Runtime dependencies are `json` and `tzinfo`. Gregorian recurrence generation is implemented by this library. Install `tzinfo-data` on systems without a zoneinfo database, including Windows. No other Gem from this format family is required.
|
|
26
|
-
|
|
27
62
|
## Scope
|
|
28
63
|
|
|
29
64
|
| Feature | Support |
|
|
@@ -55,6 +90,7 @@ patched = patch.apply(calendar.to_h)
|
|
|
55
90
|
Strict parsing raises `ValidationError` with `errors` and a JSON Pointer in `pointer`. Lenient parsing preserves invalid fields with diagnostics. Serialization always validates. Unknown root types and malformed JSON raise `ParseError`; resource bounds raise `LimitError`, including in lenient mode. Duplicate keys are rejected with both supported json major versions.
|
|
56
91
|
|
|
57
92
|
Recurrence overrides ignore the protected property prefixes specified by RFC 8984 §4.3.5. An `excluded: true` override can contain no other change. Localizations ignore disallowed paths. Patches never partially modify their target.
|
|
93
|
+
Localization language tags match without case sensitivity.
|
|
58
94
|
|
|
59
95
|
## Time and recurrence
|
|
60
96
|
|
|
@@ -81,7 +117,7 @@ Time-zone results follow the installed TZInfo data. Its explicit future transiti
|
|
|
81
117
|
|
|
82
118
|
Pass these keyword options to `parse` or model constructors. `occurrences` additionally requires `to`, defaults to `limit: 1000`, and enforces `timeout: 2.0` seconds over the entire expansion. An exclusion set larger than the candidate budget fails instead of returning an incorrect partial subtraction. Impossible recurrence rules also time out. URIs are data and are never fetched.
|
|
83
119
|
|
|
84
|
-
## Development
|
|
120
|
+
## Development
|
|
85
121
|
|
|
86
122
|
```sh
|
|
87
123
|
bundle install
|
|
@@ -97,4 +133,12 @@ RFC source documents and 52 generated examples are fetched into ignored `tmp/` w
|
|
|
97
133
|
|
|
98
134
|
Every Ruby test job checks all 42 RFC 5545 recurrence examples against the results printed in the downloaded RFC. Finite examples also check for unexpected extra occurrences; infinite examples are checked through the last printed date. RFC 8984's ten examples all round trip. See [specification decisions](docs/specification.md) for errata and extraction corrections.
|
|
99
135
|
|
|
136
|
+
## Contributing
|
|
137
|
+
|
|
138
|
+
Bug reports and pull requests are welcome on [GitHub](https://github.com/ydah/jscalendar/issues). See [Development](#development) for the checks to run before submitting a change. Report security vulnerabilities privately as described in [SECURITY.md](SECURITY.md).
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
Released under the [MIT License](LICENSE.txt).
|
|
143
|
+
|
|
100
144
|
Additional dependencies must offer the MIT license, including development and comparison tools. The Ruby runtime and its standard libraries are exceptions to this policy. Reference documents and registry facts are test/specification inputs, not dependency implementations. See [implementation provenance](docs/provenance.md) for the scope and limits of the source audit.
|
data/lib/jscalendar/calendar.rb
CHANGED
|
@@ -21,7 +21,9 @@ module Jscalendar
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
def localize(language)
|
|
24
|
-
|
|
24
|
+
localizations = @data.fetch("localizations", {})
|
|
25
|
+
key = localizations.keys.find { |tag| tag.casecmp?(language) }
|
|
26
|
+
patch = localizations[key]
|
|
25
27
|
return self.class.new(to_h, time_zones: @time_zones, **@limits) unless patch
|
|
26
28
|
|
|
27
29
|
data = PatchObject.new(PatchObject.localization(patch), **@limits).apply(to_h, validate: false)
|
data/lib/jscalendar/version.rb
CHANGED