ical2hash 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90af0276cb4a396e276a1c7e0536df50f19a40d95cd40da74110dcd811cab863
4
- data.tar.gz: fdff9b36a66c8751d7dc95b710dd51eb3e528d946f97259f64194c6a54fe5e4a
3
+ metadata.gz: 2699cbdb3088bd48e5c02d90a3186ae4f6067c9519a6c4c8313e8e15a5ec0ec0
4
+ data.tar.gz: b906e9c7c104bfabaf4fecc76e8d3173db798d168904e10bb66dfd7e443c0bcb
5
5
  SHA512:
6
- metadata.gz: 1268774fce65a3ed48fc2c7b1207550f6127d3bbeab737a3d8997fcf3628fa61b9f5182686e0bd108d26032f231ba2f7fc75f6c43cd164e2dd4a3d2450141fd4
7
- data.tar.gz: b81037406b4cf4b18457ec7b0f2b617737a33fbf6f28405fdbec77225d58914f9a19a5b3ad9299cecb788c4c3bf8e163c2d463cb8ccdf0bba64ba8f5a3e6de95
6
+ metadata.gz: 410cd021a99686af96fbb729ee4e549b425f075fe0dedf115926abbd15ce06f9ac4c23a58d5977a7fb6b74cb7d2014ac56df51575025115e7f4c7fc5159ff948
7
+ data.tar.gz: ed7faa4078c3a0edd34db44259aa2bddaa3868f5ea0c57a28dbec5199196c49f10601bbb952a4385dbc0f8516bb13eb1e2a2d1032d42382954e325a4c044f738
data/Gemfile.lock CHANGED
@@ -45,7 +45,9 @@ GEM
45
45
  unicode-display_width (2.4.2)
46
46
 
47
47
  PLATFORMS
48
+ ruby
48
49
  x86_64-darwin-21
50
+ x86_64-linux
49
51
 
50
52
  DEPENDENCIES
51
53
  bundler
data/README.md CHANGED
@@ -1,31 +1,172 @@
1
1
  # Ical2hash
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ical2hash`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Ical2hash is a Gem that can convert ics-format text into a ruby hash object.
4
+ Conversely, it also has the ability to convert from a hash object to ics format text.
6
5
 
7
6
  ## Installation
8
7
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
8
+ ```
9
+ $ gem install ical2hash
10
+ ```
10
11
 
11
- Install the gem and add to the application's Gemfile by executing:
12
+ ## Usage
12
13
 
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
14
+ ```ruby
15
+ require 'ical2hash'
14
16
 
15
- If bundler is not being used to manage dependencies, install the gem by executing:
17
+ ics_txt = <<"ics"
18
+ BEGIN:VCALENDAR
19
+ VERSION:2.0
20
+ PRODID:-//OpenAI//GPT-3.5//EN
21
+ CALSCALE:GREGORIAN
22
+ METHOD:PUBLISH
23
+ X-WR-CALNAME:Test Calendar
16
24
 
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
25
+ BEGIN:VEVENT
26
+ DTSTART:20230522T090000
27
+ DTEND:20230522T110000
28
+ SUMMARY:Meeting
29
+ DESCRIPTION:This is an internal meeting to discuss the progress of the project.
30
+ LOCATION:Conference Room A
31
+ END:VEVENT
18
32
 
19
- ## Usage
33
+ BEGIN:VEVENT
34
+ DTSTART:20230526T083000
35
+ DTEND:20230526T120000
36
+ SUMMARY:External Conference
37
+ DESCRIPTION:This is a conference with industry leaders. We will discuss market trends and competitive analysis.
38
+ LOCATION:Hotel Conference Room
39
+ END:VEVENT
40
+
41
+ END:VCALENDAR
42
+ ics
43
+
44
+ Ical2hash.convert(ics_txt)
45
+
46
+ # => {
47
+ # "VCALENDAR"=>[
48
+ # {
49
+ # "VERSION"=>"2.0",
50
+ # "PRODID"=>"-//OpenAI//GPT-3.5//EN",
51
+ # "CALSCALE"=>"GREGORIAN",
52
+ # "METHOD"=>"PUBLISH",
53
+ # "X-WR-CALNAME"=>"Test Calendar",
54
+ # "VEVENT"=>[
55
+ # {
56
+ # "DTSTART"=>"20230522T090000",
57
+ # "DTEND"=>"20230522T110000",
58
+ # "SUMMARY"=>"Meeting",
59
+ # "DESCRIPTION"=>"This is an internal meeting to discuss the progress of the project.",
60
+ # "LOCATION"=>"Conference Room A"
61
+ # },
62
+ # {
63
+ # "DTSTART"=>"20230526T083000",
64
+ # "DTEND"=>"20230526T120000",
65
+ # "SUMMARY"=>"External Conference",
66
+ # "DESCRIPTION"=>"This is a conference with industry leaders. We will discuss market trends and competitive analysis.",
67
+ # "LOCATION"=>"Hotel Conference Room"
68
+ # }
69
+ # ]
70
+ # }
71
+ # ]
72
+ # }
20
73
 
21
- TODO: Write usage instructions here
74
+ hash = {
75
+ "VCALENDAR"=>[
76
+ {
77
+ "VERSION"=>"2.0",
78
+ "PRODID"=>"-//OpenAI//GPT-3.5//EN",
79
+ "CALSCALE"=>"GREGORIAN",
80
+ "METHOD"=>"PUBLISH",
81
+ "X-WR-CALNAME"=>"Test Calendar",
82
+ "VEVENT"=>[
83
+ {
84
+ "DTSTART"=>"20230522T090000",
85
+ "DTEND"=>"20230522T110000",
86
+ "SUMMARY"=>"Meeting",
87
+ "DESCRIPTION"=>"This is an internal meeting to discuss the progress of the project.",
88
+ "LOCATION"=>"Conference Room A"
89
+ }
90
+ ]
91
+ }
92
+ ]
93
+ }
22
94
 
23
- ## Development
95
+ Ical2hash.revert(hash)
24
96
 
25
- 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.
97
+ # => "BEGIN:VCALENDAR\r\n
98
+ # VERSION:2.0\r\n
99
+ # PRODID:-//OpenAI//GPT-3.5//EN\r\n
100
+ # CALSCALE:GREGORIAN\r\nMETHOD:PUBLISH\r\n
101
+ # X-WR-CALNAME:Test Calendar\r\n
102
+ # BEGIN:VEVENT\r\n
103
+ # DTSTART:20230522T090000\r\n
104
+ # DTEND:20230522T110000\r\n
105
+ # SUMMARY:Meeting\r\n
106
+ # DESCRIPTION:This is an internal meeting to discuss the progress of the project.\r\n
107
+ # LOCATION:Conference Room A\r\n
108
+ # END:VEVENT\r\n
109
+ # END:VCALENDAR\r\n"
26
110
 
27
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
111
+
112
+ ical_hash = {
113
+ "VCALENDAR"=>[
114
+ {
115
+ "VERSION"=>"2.0",
116
+ "PRODID"=>"-//OpenAI//GPT-3.5//EN",
117
+ "CALSCALE"=>"GREGORIAN",
118
+ "METHOD"=>"PUBLISH",
119
+ "X-WR-CALNAME"=>"Test Calendar",
120
+ "VEVENT"=>[
121
+ {
122
+ "DTSTART"=>"20230522T090000",
123
+ "DTEND"=>"20230522T110000",
124
+ "SUMMARY"=>"Meeting",
125
+ "DESCRIPTION"=>"This is an internal meeting to discuss the progress of the project.",
126
+ "LOCATION"=>"Conference Room A"
127
+ }
128
+ ]
129
+ }
130
+ ]
131
+ }
132
+
133
+ ical_hash["VCALENDAR"][0]["VEVENT"] << {
134
+ "DTSTART"=>"20230526T083000",
135
+ "DTEND"=>"20230526T120000",
136
+ "SUMMARY"=>"External Conference",
137
+ "DESCRIPTION"=>"This is a conference with industry leaders. We will discuss market trends and competitive analysis.",
138
+ "LOCATION"=>"Hotel Conference Room"
139
+ }
140
+
141
+ Ical2hash.revert(ical_hash)
142
+
143
+ #=> "BEGIN:VCALENDAR\r\n
144
+ # VERSION:2.0\r\n
145
+ # PRODID:-//OpenAI//GPT-3.5//EN\r\n
146
+ # CALSCALE:GREGORIAN\r\n
147
+ # METHOD:PUBLISH\r\n
148
+ # X-WR-CALNAME:Test Calendar\r\n
149
+ # BEGIN:VEVENT\r\n
150
+ # DTSTART:20230522T090000\r\n
151
+ # DTEND:20230522T110000\r\n
152
+ # SUMMARY:Meeting\r\n
153
+ # DESCRIPTION:This is an internal meeting to discuss the progress of the project.\r\n
154
+ # LOCATION:Conference Room A\r\n
155
+ # END:VEVENT\r\n
156
+ # BEGIN:VEVENT\r\n
157
+ # DTSTART:20230526T083000\r\n
158
+ # DTEND:20230526T120000\r\n
159
+ # SUMMARY:External Conference\r\n
160
+ # DESCRIPTION:This is a conference with industry leaders. We will discuss market trends and competitive analysis.\r\n
161
+ # LOCATION:Hotel Conference Room\r\n
162
+ # END:VEVENT\r\n
163
+ # END:VCALENDAR\r\n"
164
+
165
+ ```
28
166
 
29
167
  ## Contributing
30
168
 
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ical2hash.
169
+ Bug reports and pull requests are welcome on GitHub at https://github.com/thehighhigh/ical2hash.
170
+
171
+ ## License
172
+ The gem is available as open source under the terms of the MIT License.
data/Rakefile CHANGED
@@ -1,4 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'bundler/gem_tasks'
4
- task default: %i[]
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+ task default: :spec
data/ical2hash.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = 'It can convert ical txt to hash object and revert.'
12
12
  spec.description = 'It can convert ical txt to hash object and revert.'
13
13
  spec.homepage = 'https://github.com/thehighhigh/ical2hash'
14
- spec.required_ruby_version = '>= 2.6.0'
14
+ spec.required_ruby_version = '>= 2.7.0'
15
15
  spec.license = 'MIT'
16
16
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
17
17
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ical2hash
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ical2hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thehighhigh
@@ -99,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: 2.6.0
102
+ version: 2.7.0
103
103
  required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  requirements:
105
105
  - - ">="