Skip to content

Commit

Permalink
Allow formatting integers (#591)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
joeldrapper authored Oct 11, 2023
1 parent 9e5820d commit 5a4002f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
jobs:
tests:
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest']
ruby-version:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ Style/ExplicitBlockArgument:

Style/MixinUsage:
Enabled: false

Style/RedundantDoubleSplatHashBraces:
Enabled: false
4 changes: 1 addition & 3 deletions lib/phlex/sgml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def render?
# @return [String]
def format_object(object)
case object
when Float
when Float, Integer
object.to_s
end
end
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5a4002f

Please sign in to comment.