Skip to content

Commit bdefea5

Browse files
committed
chore: bump Ruby to 3.3, use symbols for ElementPatchMode
- Ruby 3.3+ required (3.2 EOL March 2026) - Add rubygems_mfa_required metadata - Use symbols instead of strings for ElementPatchMode constants
1 parent 226deb4 commit bdefea5

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

datastar.gemspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ Gem::Specification.new do |spec|
1010

1111
spec.summary = 'Ruby SDK for Datastar. Rack-compatible.'
1212
spec.homepage = 'https://github.com/starfederation/datastar-ruby#readme'
13-
spec.required_ruby_version = '>= 3.0.0'
13+
spec.required_ruby_version = '>= 3.3.0'
1414

1515
spec.metadata['homepage_uri'] = spec.homepage
1616
spec.metadata['source_code_uri'] = 'https://github.com/starfederation/datastar-ruby'
17+
spec.metadata['rubygems_mfa_required'] = 'true'
1718

1819
# Specify which files should be added to the gem when it is released.
1920
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -29,9 +30,9 @@ Gem::Specification.new do |spec|
2930
spec.require_paths = ['lib']
3031

3132
# Uncomment to register a new dependency of your gem
32-
spec.add_dependency 'rack', '>= 3.2'
3333
spec.add_dependency 'json'
3434
spec.add_dependency 'logger'
35+
spec.add_dependency 'rack', '>= 3.2'
3536

3637
spec.add_development_dependency 'phlex'
3738
# For more information and examples about making a new gem, check out our

lib/datastar/server_sent_event_generator.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
module Datastar
66
module ElementPatchMode
77
# Morphs the element into the existing element.
8-
OUTER = 'outer'
8+
OUTER = :outer
99

1010
# Replaces the inner HTML of the existing element.
11-
INNER = 'inner'
11+
INNER = :inner
1212

1313
# Removes the existing element.
14-
REMOVE = 'remove'
14+
REMOVE = :remove
1515

1616
# Replaces the existing element with the new element.
17-
REPLACE = 'replace'
17+
REPLACE = :replace
1818

1919
# Prepends the element inside to the existing element.
20-
PREPEND = 'prepend'
20+
PREPEND = :prepend
2121

2222
# Appends the element inside the existing element.
23-
APPEND = 'append'
23+
APPEND = :append
2424

2525
# Inserts the element before the existing element.
26-
BEFORE = 'before'
26+
BEFORE = :before
2727

2828
# Inserts the element after the existing element.
29-
AFTER = 'after'
29+
AFTER = :after
3030
end
3131

3232
class ServerSentEventGenerator
@@ -98,7 +98,7 @@ def patch_elements(elements, options = BLANK_OPTIONS)
9898

9999
def remove_elements(selector, options = BLANK_OPTIONS)
100100
patch_elements(
101-
nil,
101+
nil,
102102
options.merge(
103103
MODE_DATALINE_LITERAL => ElementPatchMode::REMOVE,
104104
selector:
@@ -178,7 +178,7 @@ def build_options(options, buffer)
178178
default_value = OPTION_DEFAULTS[sse_key]
179179
buffer << "#{sse_key}: #{v}\n" unless v == default_value
180180
elsif v.is_a?(Hash)
181-
v.each do |kk, vv|
181+
v.each do |kk, vv|
182182
buffer << "data: #{k} #{kk} #{vv}\n"
183183
end
184184
elsif v.is_a?(Array)

0 commit comments

Comments
 (0)