A summary of data about the Ruby ecosystem.

https://github.com/icalendar/icalendar

icalendar.rb main repository
https://github.com/icalendar/icalendar

Keywords from Contributors

activerecord activejob mvc rubygems rack feature-flag sinatra feature-toggle feature rspec

Last synced: about 14 hours ago
JSON representation

Repository metadata

icalendar.rb main repository

README.md

iCalendar -- Internet calendaring, Ruby style

Ruby
Code Climate

http://github.com/icalendar/icalendar

Upgrade from 1.x

Better documentation is still to come, but in the meantime the changes needed to move from 1.x to 2.0 are summarized by the diff needed to update the README

DESCRIPTION

iCalendar is a Ruby library for dealing with iCalendar files in the
iCalendar format defined by RFC-5545.

EXAMPLES

Creating calendars and events

require 'icalendar'

# Create a calendar with an event (standard method)
cal = Icalendar::Calendar.new
cal.event do |e|
  e.dtstart     = Icalendar::Values::Date.new('20050428')
  e.dtend       = Icalendar::Values::Date.new('20050429')
  e.summary     = "Meeting with the man."
  e.description = "Have a long lunch meeting and decide nothing..."
  e.ip_class    = "PRIVATE"
end

cal.publish

Or you can make events like this

event = Icalendar::Event.new
event.dtstart = DateTime.civil(2006, 6, 23, 8, 30)
event.summary = "A great event!"
cal.add_event(event)

event2 = cal.event  # This automatically adds the event to the calendar
event2.dtstart = DateTime.civil(2006, 6, 24, 8, 30)
event2.summary = "Another great event!"

Support for property parameters

params = {"altrep" => "http://my.language.net", "language" => "SPANISH"}

event = cal.event do |e|
  e.dtstart = Icalendar::Values::Date.new('20050428')
  e.dtend   = Icalendar::Values::Date.new('20050429')
  e.summary = Icalendar::Values::Text.new "This is a summary with params.", params
end
event.summary.ical_params #=> {'altrep' => 'http://my.language.net', 'language' => 'SPANISH'}

# or

event = cal.event do |e|
  e.dtstart = Icalendar::Values::Date.new('20050428')
  e.dtend   = Icalendar::Values::Date.new('20050429')
  e.summary = "This is a summary with params."
  e.summary.ical_params = params
end
event.summary.ical_params #=> {'altrep' => 'http://my.language.net', 'language' => 'SPANISH'}

Support for Dates or DateTimes

Sometimes we don't care if an event's start or end are Date or DateTime objects. For this, we can use DateOrDateTime.new(value). Calling .call on the returned DateOrDateTime will immediately return the underlying Date or DateTime object.

event = cal.event do |e|
  e.dtstart = Icalendar::Values::DateOrDateTime.new('20140924')
  e.dtend   = Icalendar::Values::DateOrDateTime.new('20140925').call
  e.summary = 'This is an all-day event, because DateOrDateTime will return Dates'
end

Support for URLs

For clients that can parse and display a URL associated with an event, it's possible to assign one.

event = cal.event do |e|
  e.url = 'https://example.com'
end

We can output the calendar as a string

cal_string = cal.to_ical
puts cal_string

ALARMS

Within an event

cal.event do |e|
  # ...other event properties
  e.alarm do |a|
    a.action          = "EMAIL"
    a.description     = "This is an event reminder" # email body (required)
    a.summary         = "Alarm notification"        # email subject (required)
    a.attendee        = %w(mailto:me@my-domain.com mailto:me-too@my-domain.com) # one or more email recipients (required)
    a.append_attendee "mailto:me-three@my-domain.com"
    a.trigger         = "-PT15M" # 15 minutes before
    a.append_attach   Icalendar::Values::Uri.new("ftp://host.com/novo-procs/felizano.exe", "fmttype" => "application/binary") # email attachments (optional)
  end

  e.alarm do |a|
    a.action  = "DISPLAY" # This line isn't necessary, it's the default
    a.summary = "Alarm notification"
    a.trigger = "-P1DT0H0M0S" # 1 day before
  end

  e.alarm do |a|
    a.action        = "AUDIO"
    a.trigger       = "-PT15M"
    a.append_attach "Basso"
  end
end

Output

# BEGIN:VALARM
# ACTION:EMAIL
# ATTACH;FMTTYPE=application/binary:ftp://host.com/novo-procs/felizano.exe
# TRIGGER:-PT15M
# SUMMARY:Alarm notification
# DESCRIPTION:This is an event reminder
# ATTENDEE:mailto:me-too@my-domain.com
# ATTENDEE:mailto:me-three@my-domain.com
# END:VALARM
#
# BEGIN:VALARM
# ACTION:DISPLAY
# TRIGGER:-P1DT0H0M0S
# SUMMARY:Alarm notification
# END:VALARM
#
# BEGIN:VALARM
# ACTION:AUDIO
# ATTACH;VALUE=URI:Basso
# TRIGGER:-PT15M
# END:VALARM

Checking for an Alarm

Calling the event.alarm method will create an alarm if one doesn't exist. To check if an event has an alarm use the has_alarm? method.

event.has_alarm?
# => false

event.alarm
# => #<Icalendar::Alarm ... >

event.has_alarm?
#=> true

TIMEZONES

cal = Icalendar::Calendar.new
cal.timezone do |t|
  t.tzid = "America/Chicago"

  t.daylight do |d|
    d.tzoffsetfrom = "-0600"
    d.tzoffsetto   = "-0500"
    d.tzname       = "CDT"
    d.dtstart      = "19700308T020000"
    d.rrule        = "FREQ=YEARLY;BYMONTH=3;BYDAY=2SU"
  end

  t.standard do |s|
    s.tzoffsetfrom = "-0500"
    s.tzoffsetto   = "-0600"
    s.tzname       = "CST"
    s.dtstart      = "19701101T020000"
    s.rrule        = "FREQ=YEARLY;BYMONTH=11;BYDAY=1SU"
  end
end

Output

# BEGIN:VTIMEZONE
# TZID:America/Chicago
# BEGIN:DAYLIGHT
# TZOFFSETFROM:-0600
# TZOFFSETTO:-0500
# TZNAME:CDT
# DTSTART:19700308T020000
# RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
# END:DAYLIGHT
# BEGIN:STANDARD
# TZOFFSETFROM:-0500
# TZOFFSETTO:-0600
# TZNAME:CST
# DTSTART:19701101T020000
# RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
# END:STANDARD
# END:VTIMEZONE

iCalendar has some basic support for creating VTIMEZONE blocks from timezone information pulled from tzinfo.
You must require tzinfo support manually to take advantage.

iCalendar has been tested and works with tzinfo versions 0.3, 1.x, and 2.x. The tzinfo-data gem may also
be required depending on your version of tzinfo and potentially your operating system.

Example

require 'icalendar/tzinfo'

cal = Icalendar::Calendar.new

event_start = DateTime.new 2008, 12, 29, 8, 0, 0
event_end = DateTime.new 2008, 12, 29, 11, 0, 0

tzid = "America/Chicago"
tz = TZInfo::Timezone.get tzid
timezone = tz.ical_timezone event_start
cal.add_timezone timezone

cal.event do |e|
  e.dtstart = Icalendar::Values::DateTime.new event_start, 'tzid' => tzid
  e.dtend   = Icalendar::Values::DateTime.new event_end, 'tzid' => tzid
  e.summary = "Meeting with the man."
  e.description = "Have a long lunch meeting and decide nothing..."
  e.organizer = "mailto:jsmith@example.com"
  e.organizer = Icalendar::Values::CalAddress.new("mailto:jsmith@example.com", cn: 'John Smith')
end

Parsing iCalendars

# Open a file or pass a string to the parser
cal_file = File.open("single_event.ics")

# Parser returns an array of calendars because a single file
# can have multiple calendars.
cals = Icalendar::Calendar.parse(cal_file)
cal = cals.first

# Now you can access the cal object in just the same way I created it
event = cal.events.first

puts "start date-time: #{event.dtstart}"
puts "start date-time timezone: #{event.dtstart.ical_params['tzid']}"
puts "summary: #{event.summary}"

You can also create a Parser instance directly, this can be used to enable
strict parsing:

# Sometimes you want to strongly verify only rfc-approved properties are
# used
strict_parser = Icalendar::Parser.new(cal_file, true)
cal = strict_parser.parse

Parsing Components (e.g. Events)

# Open a file or pass a string to the parser
event_file = File.open("event.ics")

# Parser returns an array of events because a single file
# can have multiple events.
events = Icalendar::Event.parse(event_file)
event = events.first

puts "start date-time: #{event.dtstart}"
puts "start date-time timezone: #{event.dtstart.ical_params['tzid']}"
puts "summary: #{event.summary}"

Finders

Often times in web apps and other interactive applications you'll need to
lookup items in a calendar to make changes or get details. Now you can find
everything by the unique id automatically associated with all components.

cal = Calendar.new
10.times { cal.event } # Create 10 events with only default data.
some_event = cal.events[5] # Grab it from the array of events

# Use the uid as the key in your app
key = some_event.uid

# so later you can find it.
same_event = cal.find_event(key)

Examples

Check the unit tests for examples of most things you'll want to do, but please
send me example code or let me know what's missing.

Download

The latest release version of this library can be found at

Installation

It's all about rubygems:

$ gem install icalendar

Testing

To run the tests:

$ bundle install
$ rake spec

License

This library is released under the same license as Ruby itself.

Support & Contributions

Please submit pull requests from a rebased topic branch and
include tests for all bugs and features.

Contributor Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.

This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the Contributor Covenant, version 1.1.0, available at http://contributor-covenant.org/version/1/1/0/


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 2 days ago

Total Commits: 416
Total Committers: 76
Avg Commits per committer: 5.474
Development Distribution Score (DDS): 0.736

Commits in past year: 18
Committers in past year: 4
Avg Commits per committer in past year: 4.5
Development Distribution Score (DDS) in past year: 0.389

Name Email Commits
Ryan Ahearn r****n@g****m 110
Ryan Ahearn r****n@c****m 107
Sean Dague s****n@d****t 55
Patrick Schnetger p****r@g****m 12
Timm k****h@g****m 7
Mark Yoon y****n@n****u 6
Pawel Niewiadomski 1****b@g****m 6
Jake Craige j****e@p****m 4
Garry Shutler g****y@r****k 4
Eric Carty-Fickes e****f@n****u 4
David Grandinetti d****e@w****m 4
sue445 s****5@s****t 3
John Hope i****o@m****m 3
Chris Zelenak s****e@s****) 3
Benjamin Jørgensen b****n@b****m 3
Jan Vlnas g****t@j****z 3
Mark Rickert m****1@g****m 3
Niels Laukens n****s@d****e 3
Pat Allan p****t@f****m 3
Rick DeNatale r****e@g****m 3
Thomas Cannon t****0@g****m 3
grosser g****l@g****m 3
Jo Potts j****s@g****m 2
Michael Richardson m****r@s****a 2
Ronak Gothi r****k@a****m 2
bouzuya b****a@g****m 2
Guillaume Briday 8****y 2
David Bradford d****d@z****m 2
Ben Walding b****n@w****m 2
Christoph Finkensiep c****p@f****e 2
and 46 more...

Committer domains:


Issue and Pull Request metadata

Last synced: about 1 month ago

Total issues: 78
Total pull requests: 73
Average time to close issues: 7 months
Average time to close pull requests: 6 months
Total issue authors: 68
Total pull request authors: 38
Average comments per issue: 2.62
Average comments per pull request: 0.93
Merged pull request: 49
Bot issues: 0
Bot pull requests: 1

Past year issues: 9
Past year pull requests: 13
Past year average time to close issues: 19 days
Past year average time to close pull requests: 5 days
Past year issue authors: 8
Past year pull request authors: 7
Past year average comments per issue: 1.78
Past year average comments per pull request: 0.31
Past year merged pull request: 8
Past year bot issues: 0
Past year bot pull requests: 1

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/icalendar/icalendar

Top Issue Authors

  • rahearn (3)
  • espen (3)
  • jasonkarns (2)
  • Mange (2)
  • tfreedman (2)
  • ryanckulp (2)
  • Congrammers (2)
  • achmet9948 (2)
  • rbq (1)
  • mzane42 (1)
  • sumitdey035 (1)
  • chinanoahli (1)
  • jinhianlee (1)
  • SLuoWorkRamp (1)
  • WoLkErSs (1)

Top Pull Request Authors

  • rahearn (23)
  • jayscruggs856 (3)
  • mcr (3)
  • pawelniewie (2)
  • guillaumebriday (2)
  • ron (2)
  • aki77 (2)
  • tisdall (2)
  • botandrose (2)
  • pat (2)
  • tcannonfodder (2)
  • rthbound (2)
  • JamesWatling (1)
  • 1Mark (1)
  • vwyu (1)

Top Issue Labels

  • 2.x (2)
  • enhancement (2)
  • docs (1)
  • bug (1)

Top Pull Request Labels


Package metadata

gem.coop: icalendar

Implements the iCalendar specification (RFC-5545) in Ruby. This allows for the generation and parsing of .ics files, which are used by a variety of calendaring applications.

  • Homepage: https://github.com/icalendar/icalendar
  • Documentation: http://www.rubydoc.info/gems/icalendar/
  • Licenses: BSD-2-Clause,GPL-3.0-only,icalendar
  • Latest release: 2.12.1 (published about 2 months ago)
  • Last Synced: 2025-12-15T09:49:44.491Z (1 day ago)
  • Versions: 68
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 72,450,256 Total
  • Docker Downloads: 563,280,590
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.138%
    • Docker downloads count: 0.166%
    • Downloads: 0.388%
  • Maintainers (3)
rubygems.org: icalendar

Implements the iCalendar specification (RFC-5545) in Ruby. This allows for the generation and parsing of .ics files, which are used by a variety of calendaring applications.

  • Homepage: https://github.com/icalendar/icalendar
  • Documentation: http://www.rubydoc.info/gems/icalendar/
  • Licenses: BSD-2-Clause,GPL-3.0-only,icalendar
  • Latest release: 2.12.1 (published about 2 months ago)
  • Last Synced: 2025-12-15T09:49:44.484Z (1 day ago)
  • Versions: 68
  • Dependent Packages: 79
  • Dependent Repositories: 2,724
  • Downloads: 72,450,256 Total
  • Docker Downloads: 563,280,590
  • Rankings:
    • Docker downloads count: 0.203%
    • Dependent packages count: 0.386%
    • Downloads: 0.422%
    • Dependent repos count: 0.613%
    • Average: 0.902%
    • Stargazers count: 1.822%
    • Forks count: 1.964%
  • Maintainers (3)
proxy.golang.org: github.com/icalendar/icalendar

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/icalendar/icalendar#section-documentation
  • Licenses: other
  • Latest release: v2.12.1+incompatible (published about 2 months ago)
  • Last Synced: 2025-12-15T09:49:46.434Z (1 day ago)
  • Versions: 40
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Stargazers count: 1.948%
    • Forks count: 2.088%
    • Average: 5.37%
    • Dependent packages count: 8.098%
    • Dependent repos count: 9.346%

Dependencies

.github/workflows/main.yml actions
  • actions/checkout v2 composite
  • ruby/setup-ruby v1 composite
icalendar.gemspec rubygems
  • activesupport ~> 6.0 development
  • bundler ~> 2.0 development
  • i18n ~> 1.8 development
  • rake ~> 13.0 development
  • rspec ~> 3.8 development
  • simplecov ~> 0.16 development
  • timecop ~> 0.9 development
  • tzinfo ~> 1.2 development
  • tzinfo-data ~> 1.2020 development
  • ice_cube ~> 0.16

Score: 32.39749093377519