Commit be6f088f by Cuong Tran

Merge pull request #257 from jmondo/default_arrays

Quote each value in default arrays
parents 02ed4dae 5f9fa909
......@@ -93,6 +93,7 @@ module AnnotateModels
when Float, Fixnum, Bignum then value.to_s
# BigDecimals need to be output in a non-normalized form and quoted.
when BigDecimal then value.to_s('F')
when Array then value.map {|v| quote(v)}
else
value.inspect
end
......
......@@ -56,6 +56,8 @@ describe AnnotateModels do
it { expect(AnnotateModels.quote(25)).to eql("25") }
it { expect(AnnotateModels.quote(25.6)).to eql("25.6") }
it { expect(AnnotateModels.quote(1e-20)).to eql("1.0e-20") }
it { expect(AnnotateModels.quote(BigDecimal.new("1.2"))).to eql("1.2") }
it { expect(AnnotateModels.quote([BigDecimal.new("1.2")])).to eql(["1.2"]) }
it "should get schema info" do
klass = mock_class(:users, :id, [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment