From 0dbedc9ba9c7e1a947be9100fdd0c54e14993a7f Mon Sep 17 00:00:00 2001 From: Miles Georgi Date: Sat, 25 Jan 2025 11:39:18 -0800 Subject: [PATCH] Allow default_serializers to be overridden --- CHANGELOG.md | 4 ++++ Gemfile.lock | 14 +++++++------- boot/start.rb | 2 +- src/http.rb | 16 +++++++++++----- version.rb | 2 +- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a947ca3..3ca51bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [0.0.10] - 2025-01-25 + +- Allow default_serializers to be changed + ## [0.0.9] - 2025-01-07 - Bump Ruby to 3.4.1 diff --git a/Gemfile.lock b/Gemfile.lock index 4bada77..397afd4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - foobara-http-command-connector (0.0.9) + foobara-http-command-connector (0.0.10) foobara GEM @@ -54,7 +54,7 @@ GEM foobara-type-generator foobara-typescript-react-command-form-generator foobara-typescript-remote-command-generator - foobara (0.0.47) + foobara (0.0.50) bigdecimal foobara-util foobara-autocrud-generator (0.0.1) @@ -145,7 +145,7 @@ GEM listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - logger (1.6.4) + logger (1.6.5) lumberjack (1.2.10) method_source (1.1.0) nenv (0.3.0) @@ -154,7 +154,7 @@ GEM shellany (~> 0.0) ostruct (0.6.1) parallel (1.26.3) - parser (3.3.6.0) + parser (3.3.7.0) ast (~> 2.4.1) racc pry (0.14.2) @@ -188,7 +188,7 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.2) - rubocop (1.69.2) + rubocop (1.71.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -202,7 +202,7 @@ GEM parser (>= 3.3.1.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - rubocop-rspec (3.3.0) + rubocop-rspec (3.4.0) rubocop (~> 1.61) ruby-prof (1.7.1) ruby-progressbar (1.13.0) @@ -214,7 +214,7 @@ GEM simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) thor (1.3.2) - unicode-display_width (3.1.3) + unicode-display_width (3.1.4) unicode-emoji (~> 4.0, >= 4.0.4) unicode-emoji (4.0.4) vcr (6.3.1) diff --git a/boot/start.rb b/boot/start.rb index 1a04366..6e68f31 100644 --- a/boot/start.rb +++ b/boot/start.rb @@ -2,7 +2,7 @@ require "bundler/setup" -if ENV["FOOBARA_ENV"] == "development" || ENV["FOOBARA_ENV"] == "test" +if %w[development test].include?(ENV["FOOBARA_ENV"]) require "pry" require "pry-byebug" end diff --git a/src/http.rb b/src/http.rb index 4aa7e85..4db1bf4 100644 --- a/src/http.rb +++ b/src/http.rb @@ -3,15 +3,21 @@ module CommandConnectors class Http < CommandConnector include TruncatedInspect + class << self + attr_accessor :default_serializers + end + + self.default_serializers = [ + Foobara::CommandConnectors::Serializers::ErrorsSerializer, + Foobara::CommandConnectors::Serializers::AtomicSerializer, + Foobara::CommandConnectors::Serializers::JsonSerializer + ] + attr_accessor :prefix def initialize( prefix: nil, - default_serializers: [ - Foobara::CommandConnectors::Serializers::ErrorsSerializer, - Foobara::CommandConnectors::Serializers::AtomicSerializer, - Foobara::CommandConnectors::Serializers::JsonSerializer - ], + default_serializers: self.class.default_serializers, ** ) if prefix diff --git a/version.rb b/version.rb index 99019c7..a31725d 100644 --- a/version.rb +++ b/version.rb @@ -1,6 +1,6 @@ module Foobara module HttpCommandConnector - VERSION = "0.0.9".freeze + VERSION = "0.0.10".freeze local_ruby_version = File.read("#{__dir__}/.ruby-version").chomp local_ruby_version_minor = local_ruby_version[/\A(\d+\.\d+)\.\d+\z/, 1]