Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
annotate
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
annotate
Commits
be6f088f
Commit
be6f088f
authored
Jun 16, 2015
by
Cuong Tran
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #257 from jmondo/default_arrays
Quote each value in default arrays
parents
02ed4dae
5f9fa909
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
0 deletions
+3
-0
annotate_models.rb
lib/annotate/annotate_models.rb
+1
-0
annotate_models_spec.rb
spec/annotate/annotate_models_spec.rb
+2
-0
No files found.
lib/annotate/annotate_models.rb
View file @
be6f088f
...
...
@@ -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
...
...
spec/annotate/annotate_models_spec.rb
View file @
be6f088f
...
...
@@ -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
(
1
e
-
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
,
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment