fix(json): Fix jsonification for Ruby < 2.4
This commit is contained in:
		
							parent
							
								
									0d725689a1
								
							
						
					
					
						commit
						4e45d7757a
					
				| @ -104,6 +104,12 @@ module Jekyll | ||||
|           Integer, Float, | ||||
|           String | ||||
|         ] | ||||
|         # Integer arrived in Ruby 2.4. Before that it was Fixnum and Bignum | ||||
|         if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.4.0') | ||||
|           # rubocop:disable Lint/UnifiedInteger | ||||
|           simple_types += [Fixnum, Bignum] | ||||
|           # rubocop:enable Lint/UnifiedInteger | ||||
|         end | ||||
|         return item if simple_types.member?(item.class) | ||||
| 
 | ||||
|         # Recursive types | ||||
|  | ||||
| @ -161,7 +161,7 @@ describe(Jekyll::Algolia::Utils) do | ||||
|       let(:item) { 'foo' } | ||||
|       it { should eq 'foo' } | ||||
|     end | ||||
|     context 'with a number' do | ||||
|     context 'with an integer' do | ||||
|       let(:item) { 42 } | ||||
|       it { should eq 42 } | ||||
|     end | ||||
| @ -169,6 +169,10 @@ describe(Jekyll::Algolia::Utils) do | ||||
|       let(:item) { 42.42 } | ||||
|       it { should eq 42.42 } | ||||
|     end | ||||
|     context 'with a large number' do | ||||
|       let(:item) { 2**62 } | ||||
|       it { should eq 2**62 } | ||||
|     end | ||||
|     context 'with a boolean (true)' do | ||||
|       let(:item) { true } | ||||
|       it { should eq true } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user