From 5a4002f906dbf20e09fd087f51a5841e85187064 Mon Sep 17 00:00:00 2001 From: Joel Drapper Date: Wed, 11 Oct 2023 14:57:38 +0100 Subject: [PATCH] Allow formatting integers (#591) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I’m removing the fast path for rendering Integers because I think it makes sense to be able to format Integers by overriding `format_object`. --- .github/workflows/ci.yml | 8 +++----- .rubocop.yml | 3 +++ lib/phlex/sgml.rb | 4 +--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbe2e291..252e4f8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,7 @@ on: jobs: tests: strategy: + fail-fast: false matrix: os: ['ubuntu-latest', 'macos-latest'] ruby-version: @@ -20,8 +21,8 @@ jobs: - 'truffleruby-22.3' - 'truffleruby-head' - - 'jruby-9.4.0.0' - - 'jruby-head' + # - 'jruby-9.4.0.0' + # - 'jruby-head' runs-on: ${{ matrix.os }} steps: @@ -39,9 +40,6 @@ jobs: - name: Tests run: bundle exec sus - - name: GreenDots tests - run: bundle exec gd gd - rubocop: runs-on: 'ubuntu-latest' steps: diff --git a/.rubocop.yml b/.rubocop.yml index 7c34ff50..8f5fa75e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -10,3 +10,6 @@ Style/ExplicitBlockArgument: Style/MixinUsage: Enabled: false + +Style/RedundantDoubleSplatHashBraces: + Enabled: false diff --git a/lib/phlex/sgml.rb b/lib/phlex/sgml.rb index d260eafd..c2e80020 100644 --- a/lib/phlex/sgml.rb +++ b/lib/phlex/sgml.rb @@ -259,7 +259,7 @@ def render? # @return [String] def format_object(object) case object - when Float + when Float, Integer object.to_s end end @@ -338,8 +338,6 @@ def __text__(content) @_context.target << ERB::Escape.html_escape(content) when Symbol @_context.target << ERB::Escape.html_escape(content.name) - when Integer - @_context.target << content.to_s when nil nil else