[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7969":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":22,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":16,"starSnapshotCount":16,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},7969,"ice_cube","ice-cube-ruby\u002Fice_cube","ice-cube-ruby","Ruby Date Recurrence Library - Allows easy creation of recurrence rules and fast querying","",null,"Ruby",2470,357,34,41,0,3,29.66,"MIT License",false,"master",true,[24],"ruby","2026-06-12 02:01:47","# ice_cube - Easy schedule expansion\n\n[![Tests](https:\u002F\u002Fgithub.com\u002Fseejohnrun\u002Fice_cube\u002Factions\u002Fworkflows\u002Ftests.yaml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fseejohnrun\u002Fice_cube\u002Factions\u002Fworkflows\u002Ftests.yaml)\n[![Gem Version](https:\u002F\u002Fbadge.fury.io\u002Frb\u002Fice_cube.svg)](http:\u002F\u002Fbadge.fury.io\u002Frb\u002Fice_cube)\n[![Ruby Style Guide](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcode_style-standard-brightgreen.svg)](https:\u002F\u002Fgithub.com\u002Ftestdouble\u002Fstandard)\n\n```bash\ngem install ice_cube\n```\n\nice_cube is a ruby library for easily handling repeated events (schedules).\nThe API is modeled after [iCalendar events][ical-3.6.1], in a pleasant Ruby\nsyntax. The power lies in the ability to specify multiple rules, and have\nice_cube quickly figure out whether the schedule falls on a certain date\n(.occurs_on?), or what times it occurs at (.occurrences, .first,\n.all_occurrences).\n\nImagine you want:\n\n> Every friday the 13th that falls in October\n\nYou would write:\n\n```ruby\nschedule = IceCube::Schedule.new\nschedule.add_recurrence_rule(\n  IceCube::Rule.yearly.day_of_month(13).day(:friday).month_of_year(:october)\n)\n```\n\n---\n\n## Quick Introductions\n\n* Presentation from Lone Star Ruby Conf ([slides][ice_cube-lone_star_pdf], [YouTube](https:\u002F\u002Fyoutu.be\u002FdOMW0WcvvRc))\n* [Quick Introduction][ice_cube-ruby_nyc_pdf]\n* [Documentation Website][ice_cube-docs]\n\n---\n\nWith ice_cube, you can specify (in increasing order of precedence):\n\n* Recurrence Rules - Rules on how to include recurring times in a schedule\n* Recurrence Times - To specifically include in a schedule\n* Exception Times - To specifically exclude from a schedule\n\nExample: Specifying a recurrence with an exception time. Requires \"rails\u002Factivesupport\" (`gem install 'activesupport'`).\n\n\n```ruby\nrequire 'ice_cube'\nrequire 'active_support\u002Ftime'\n\nschedule = IceCube::Schedule.new(now = Time.now) do |s|\n  s.add_recurrence_rule(IceCube::Rule.daily.count(4))\n  s.add_exception_time(now + 1.day)\nend\n\n# list occurrences until end_time (end_time is needed for non-terminating rules)\noccurrences = schedule.occurrences(end_time) # [now]\n\n# or all of the occurrences (only for terminating schedules)\noccurrences = schedule.all_occurrences # [now, now + 2.days, now + 3.days]\n\n# or check just a single time\nschedule.occurs_at?(now + 1.day)  # false\nschedule.occurs_at?(now + 2.days) # true\n\n# or check just a single day\nschedule.occurs_on?(Date.today) # true\n\n# or check whether it occurs between two dates\nschedule.occurs_between?(now, now + 30.days)          # true\nschedule.occurs_between?(now + 4.days, now + 30.days) # false\n\n# or the first (n) occurrences\nschedule.first(2) # [now, now + 2.days]\nschedule.first    # now\n\n# or the last (n) occurrences (if the schedule terminates)\nschedule.last(2) # [now + 2.days, now + 3.days]\nschedule.last    # now + 3.days\n\n# or the next occurrence\nschedule.next_occurrence(from_time)     # defaults to Time.now\nschedule.next_occurrences(4, from_time) # defaults to Time.now\nschedule.remaining_occurrences          # for terminating schedules\n\n# or the previous occurrence\nschedule.previous_occurrence(from_time)\nschedule.previous_occurrences(4, from_time)\n\n# or include prior occurrences with a duration overlapping from_time\nschedule.next_occurrences(4, from_time, spans: true)\nschedule.occurrences_between(from_time, to_time, spans: true)\n\n# or give the schedule a duration and ask if occurring_at?\nschedule = IceCube::Schedule.new(now, duration: 3600)\nschedule.add_recurrence_rule IceCube::Rule.daily\nschedule.occurring_at?(now + 1800) # true\nschedule.occurring_between?(t1, t2)\n\n# using end_time also sets the duration\nschedule = IceCube::Schedule.new(start = Time.now, end_time: start + 3600)\nschedule.add_recurrence_rule IceCube::Rule.daily\nschedule.occurring_at?(start + 3599) # true\nschedule.occurring_at?(start + 3600) # false\n\n# take control and use iteration\nschedule = IceCube::Schedule.new\nschedule.add_recurrence_rule IceCube::Rule.daily.until(Date.today + 30)\nschedule.each_occurrence { |t| puts t }\n```\n\nThe reason that schedules have durations and not individual rules, is to\nmaintain compatibility with the ical\nRFC: http:\u002F\u002Fwww.kanzaki.com\u002Fdocs\u002Fical\u002Frrule.html\n\nTo limit schedules use `count` or `until` on the recurrence rules. Setting `end_time` on the schedule just sets the duration (from the start time) for each occurrence.\n\n---\n\n## Time Zones and ActiveSupport vs. Standard Ruby Time Classes\n\nice_cube works great without ActiveSupport but only supports the environment's\nsingle \"local\" time zone (`ENV['TZ']`) or UTC. To correctly support multiple\ntime zones (especially for DST), you should require 'active_support\u002Ftime'.\n\nA schedule's occurrences will be returned in the same class and time zone as\nthe schedule's start_time. Schedule start times are supported as:\n\n* Time.local (default when no time is specified)\n* Time.utc\n* ActiveSupport::TimeWithZone (with `Time.zone.now`, `Time.zone.local`, `time.in_time_zone(tz)`)\n* DateTime (deprecated) and Date are converted to a Time.local\n\n---\n\n## Persistence\n\nice_cube implements its own hash-based .to_yaml, so you can quickly (and\nsafely) serialize schedule objects in and out of your data store\n\nIt also supports partial serialization to\u002Ffrom `ICAL`. Parsing datetimes with time zone information is not currently supported.\n\n``` ruby\nyaml = schedule.to_yaml\nIceCube::Schedule.from_yaml(yaml)\n\nhash = schedule.to_hash\nIceCube::Schedule.from_hash(hash)\n\nical = schedule.to_ical\nIceCube::Schedule.from_ical(ical)\n```\n\n---\n\n## Using your words\n\nice_cube can provide ical or string representations of individual rules, or the\nwhole schedule.\n\n```ruby\nrule = IceCube::Rule.daily(2).day_of_week(tuesday: [1, -1], wednesday: [2])\n\nrule.to_ical # 'FREQ=DAILY;INTERVAL=2;BYDAY=1TU,-1TU,2WE'\n\nrule.to_s # 'Every 2 days on the last and 1st Tuesdays and the 2nd Wednesday'\n```\n\n---\n\n## Some types of Rules\n\nThere are many types of recurrence rules that can be added to a schedule:\n\n### Daily\n\n```ruby\n# every day\nschedule.add_recurrence_rule IceCube::Rule.daily\n\n# every third day\nschedule.add_recurrence_rule IceCube::Rule.daily(3)\n```\n\n### Weekly\n\n```ruby\n# every week\nschedule.add_recurrence_rule IceCube::Rule.weekly\n\n# every other week on monday and tuesday\nschedule.add_recurrence_rule IceCube::Rule.weekly(2).day(:monday, :tuesday)\n\n# for programmatic convenience (same as above)\nschedule.add_recurrence_rule IceCube::Rule.weekly(2).day(1, 2)\n\n# specifying a weekly interval with a different first weekday (defaults to Sunday)\nschedule.add_recurrence_rule IceCube::Rule.weekly(1, :monday)\n```\n\n### Monthly (by day of month)\n\n```ruby\n# every month on the first and last days of the month\nschedule.add_recurrence_rule IceCube::Rule.monthly.day_of_month(1, -1)\n\n# every other month on the 15th of the month\nschedule.add_recurrence_rule IceCube::Rule.monthly(2).day_of_month(15)\n```\n\nMonthly rules will skip months that are too short for the specified day of\nmonth (e.g. no occurrences in February for `day_of_month(31)`).\n\n### Monthly (by day of Nth week)\n\n```ruby\n# every month on the first and last tuesdays of the month\nschedule.add_recurrence_rule IceCube::Rule.monthly.day_of_week(tuesday: [1, -1])\n\n# every other month on the first monday and last tuesday\nschedule.add_recurrence_rule IceCube::Rule.monthly(2).day_of_week(\n  monday: [1],\n  tuesday: [-1]\n)\n\n# for programmatic convenience (same as above)\nschedule.add_recurrence_rule IceCube::Rule.monthly(2).day_of_week(1 => [1], 2 => [-1])\n```\n\n### Yearly (by day of year)\n\n```ruby\n# every year on the 100th days from the beginning and end of the year\nschedule.add_recurrence_rule IceCube::Rule.yearly.day_of_year(100, -100)\n\n# every fourth year on new year's eve\nschedule.add_recurrence_rule IceCube::Rule.yearly(4).day_of_year(-1)\n```\n\n### Yearly (by month of year)\n\n```ruby\n# every year on the same day as start_time but in january and february\nschedule.add_recurrence_rule IceCube::Rule.yearly.month_of_year(:january, :february)\n\n# every third year in march\nschedule.add_recurrence_rule IceCube::Rule.yearly(3).month_of_year(:march)\n\n# for programmatic convenience (same as above)\nschedule.add_recurrence_rule IceCube::Rule.yearly(3).month_of_year(3)\n```\n\n### BYSETPOS (select the nth occurrence)\n\nBYSETPOS selects the nth occurrence within each interval after all other BYxxx\nfilters\u002Fexpansions are applied. Use positive values (from the start) or\nnegative values (from the end). Repeated values do not duplicate occurrences,\nand positions beyond the set size yield no occurrence for that interval.\nRFC 5545 requires BYSETPOS to be used with another BYxxx rule part; IceCube\nallows BYSETPOS without another BYxxx and applies it to the single occurrence\nin each interval.\n\n```ruby\n# last weekday of the month\nschedule.add_recurrence_rule(\n  IceCube::Rule.monthly.day(:monday, :tuesday, :wednesday, :thursday, :friday).by_set_pos(-1)\n)\n\n# second occurrence in each day's expanded set\nschedule.add_recurrence_rule(\n  IceCube::Rule.daily.hour_of_day(9, 17).by_set_pos(2)\n)\n```\n\nNote: If you expand with BYHOUR\u002FBYMINUTE\u002FBYSECOND, any unspecified smaller\ntime components are inherited from the schedule's start_time.\n\n### Hourly (by hour of day)\n\n```ruby\n# every hour on the same minute and second as start date\nschedule.add_recurrence_rule IceCube::Rule.hourly\n\n# every other hour, on mondays\nschedule.add_recurrence_rule IceCube::Rule.hourly(2).day(:monday)\n```\n\n### Minutely (every N minutes)\n\n```ruby\n# every 10 minutes\nschedule.add_recurrence_rule IceCube::Rule.minutely(10)\n\n# every hour and a half, on the last tuesday of the month\nschedule.add_recurrence_rule IceCube::Rule.minutely(90).day_of_week(tuesday: [-1])\n```\n\n### Secondly (every N seconds)\n\n```ruby\n# every second\nschedule.add_recurrence_rule IceCube::Rule.secondly\n\n# every 15 seconds between 12:00 - 12:59\nschedule.add_recurrence_rule IceCube::Rule.secondly(15).hour_of_day(12)\n```\n\n---\n\n## recurring_select\n\nThe team over at [GetJobber](http:\u002F\u002Fgetjobber.com\u002F) have open-sourced\nRecurringSelect, which makes working with IceCube easier in a Rails app\nvia some nice helpers.\n\nCheck it out at\nhttps:\u002F\u002Fgithub.com\u002FGetJobber\u002Frecurring_select\n\n---\n\n## Contributors\n\nhttps:\u002F\u002Fgithub.com\u002Fice-cube-ruby\u002Fice_cube\u002Fgraphs\u002Fcontributors\n\n---\n\n## Issues?\n\nUse the GitHub [issue tracker][ice_cube-issues]\n\n## Contributing\n\n* Contributions are welcome - I use GitHub for issue\n\ttracking (accompanying failing tests are awesome) and feature requests\n* Submit via fork and pull request (include tests)\n* If you're working on something major, shoot me a message beforehand\n\n\n\n[ical-3.6.1]: https:\u002F\u002Ftools.ietf.org\u002Fhtml\u002Frfc5545#section-3.6.1\n[ice_cube-lone_star_pdf]: https:\u002F\u002Fice-cube-ruby.github.io\u002Fice_cube\u002Fstatic\u002Flsrc_ice_cube.pdf\n[ice_cube-ruby_nyc_pdf]: https:\u002F\u002Fice-cube-ruby.github.io\u002Fice_cube\u002Fstatic\u002Fice_cube_ruby_nyc.pdf\n[ice_cube-docs]: https:\u002F\u002Fice-cube-ruby.github.io\u002Fice_cube\u002F\n[ice_cube-issues]: https:\u002F\u002Fgithub.com\u002Fice-cube-ruby\u002Fice_cube\u002Fissues\n","ice_cube 是一个 Ruby 库，用于轻松处理重复事件（日程）。它提供了强大的功能，如创建复杂的重复规则、指定特定的日期和时间以及排除特定的时间。用户可以使用类似 iCalendar 的语法来定义规则，并通过简单的 API 查询某个日期是否符合规则或获取所有符合条件的时间点。该库适用于需要灵活处理日程安排的应用场景，比如项目管理软件、日历应用等，特别适合于那些需要精确控制重复事件及其例外情况的开发环境。",2,"2026-06-11 03:15:26","top_language"]